public NioEventLoop(NioEventLoopGroup parent, Executor executor, SelectorProvider provider) : base(parent, executor, false, DEFAULT_MAX_PENDING_TASKS) { if (provider == null) { throw new NullReferenceException("selectorProvider"); } this.provider = provider; SelectorTuple selectorTuple = openSelector(); selector = selectorTuple.selector; _unwrappedSelector = selectorTuple.unwrappedSelector; }
private static io.netty.nio.SocketChannel newSocket(SelectorProvider provider) { try { /** * Use the {@link SelectorProvider} to open {@link SocketChannel} and so remove condition in * {@link SelectorProvider#provider()} which is called by each SocketChannel.open() otherwise. * * See <a href="https://github.com/netty/netty/issues/2308">#2308</a>. */ return(provider.openSocketChannel()); } catch (IOException e) { throw new ChannelException("Failed to open a socket.", e); } }
/// <summary>Takes one selector from end of LRU list of free selectors.</summary> /// <remarks> /// Takes one selector from end of LRU list of free selectors. /// If there are no selectors awailable, it creates a new selector. /// Also invokes trimIdleSelectors(). /// </remarks> /// <param name="channel"/> /// <returns></returns> /// <exception cref="System.IO.IOException"/> private SocketIOWithTimeout.SelectorPool.SelectorInfo Get(SelectableChannel channel ) { lock (this) { SocketIOWithTimeout.SelectorPool.SelectorInfo selInfo = null; SelectorProvider provider = channel.Provider(); // pick the list : rarely there is more than one provider in use. SocketIOWithTimeout.SelectorPool.ProviderInfo pList = providerList; while (pList != null && pList.provider != provider) { pList = pList.next; } if (pList == null) { //LOG.info("Creating new ProviderInfo : " + provider.toString()); pList = new SocketIOWithTimeout.SelectorPool.ProviderInfo(); pList.provider = provider; pList.queue = new List <SocketIOWithTimeout.SelectorPool.SelectorInfo>(); pList.next = providerList; providerList = pList; } List <SocketIOWithTimeout.SelectorPool.SelectorInfo> queue = pList.queue; if (queue.IsEmpty()) { Selector selector = provider.OpenSelector(); selInfo = new SocketIOWithTimeout.SelectorPool.SelectorInfo(); selInfo.selector = selector; selInfo.queue = queue; } else { selInfo = queue.RemoveLast(); } TrimIdleSelectors(Time.Now()); return(selInfo); } }
public AbstractSelectableChannel(SelectorProvider prm1) { }
public AbstractSelector(SelectorProvider prm1) { }
public NioEventLoopGroup(int nThreads, Executor executor, SelectorProvider provider) : base(nThreads, executor, provider) { }
public NioEventLoopGroup(int nThreads, Executor executor) : this(nThreads, executor, SelectorProvider.provider()) { }
/// <summary> /// Opens a socket channel. /// /// <para> The new channel is created by invoking the {@link /// java.nio.channels.spi.SelectorProvider#openSocketChannel /// openSocketChannel} method of the system-wide default {@link /// java.nio.channels.spi.SelectorProvider} object. </para> /// </summary> /// <returns> A new socket channel /// </returns> /// <exception cref="IOException"> /// If an I/O error occurs </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static SocketChannel open() throws java.io.IOException public static SocketChannel Open() { return(SelectorProvider.Provider().OpenSocketChannel()); }
/// <summary> /// Initializes a new instance of this class. /// </summary> /// <param name="provider"> /// The provider that created this channel </param> protected internal SocketChannel(SelectorProvider provider) : base(provider) { }
/// <summary> /// Opens a selector. /// /// <para> The new selector is created by invoking the {@link /// java.nio.channels.spi.SelectorProvider#openSelector openSelector} method /// of the system-wide default {@link /// java.nio.channels.spi.SelectorProvider} object. </para> /// </summary> /// <returns> A new selector /// </returns> /// <exception cref="IOException"> /// If an I/O error occurs </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static Selector open() throws java.io.IOException public static Selector Open() { return(SelectorProvider.Provider().OpenSelector()); }
/// <summary> /// �v���o�C�_�[������ DatagramChannel �I�u�W�F�N�g��쐬���܂��B /// </summary> /// <param name="provider"></param> protected DatagramChannel(SelectorProvider provider) { }
public NioSocketChannel(SelectorProvider provider) : this(newSocket(provider)) { }
/// <summary> /// Opens a pipe. /// /// <para> The new pipe is created by invoking the {@link /// java.nio.channels.spi.SelectorProvider#openPipe openPipe} method of the /// system-wide default <seealso cref="java.nio.channels.spi.SelectorProvider"/> /// object. </para> /// </summary> /// <returns> A new pipe /// </returns> /// <exception cref="IOException"> /// If an I/O error occurs </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static Pipe open() throws java.io.IOException public static Pipe Open() { return(SelectorProvider.Provider().OpenPipe()); }
/// <summary> /// Opens a datagram channel. /// /// <para> The {@code family} parameter is used to specify the {@link /// ProtocolFamily}. If the datagram channel is to be used for IP multicasting /// then this should correspond to the address type of the multicast groups /// that this channel will join. /// /// </para> /// <para> The new channel is created by invoking the {@link /// java.nio.channels.spi.SelectorProvider#openDatagramChannel(ProtocolFamily) /// openDatagramChannel} method of the system-wide default {@link /// java.nio.channels.spi.SelectorProvider} object. The channel will not be /// connected. /// /// </para> /// </summary> /// <param name="family"> /// The protocol family /// </param> /// <returns> A new datagram channel /// </returns> /// <exception cref="UnsupportedOperationException"> /// If the specified protocol family is not supported. For example, /// suppose the parameter is specified as {@link /// java.net.StandardProtocolFamily#INET6 StandardProtocolFamily.INET6} /// but IPv6 is not enabled on the platform. </exception> /// <exception cref="IOException"> /// If an I/O error occurs /// /// @since 1.7 </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static DatagramChannel open(java.net.ProtocolFamily family) throws java.io.IOException public static DatagramChannel Open(ProtocolFamily family) { return(SelectorProvider.Provider().OpenDatagramChannel(family)); }
/// <summary> /// Opens a datagram channel. /// /// <para> The new channel is created by invoking the {@link /// java.nio.channels.spi.SelectorProvider#openDatagramChannel() /// openDatagramChannel} method of the system-wide default {@link /// java.nio.channels.spi.SelectorProvider} object. The channel will not be /// connected. /// /// </para> /// <para> The <seealso cref="ProtocolFamily ProtocolFamily"/> of the channel's socket /// is platform (and possibly configuration) dependent and therefore unspecified. /// The <seealso cref="#open(ProtocolFamily) open"/> allows the protocol family to be /// selected when opening a datagram channel, and should be used to open /// datagram channels that are intended for Internet Protocol multicasting. /// /// </para> /// </summary> /// <returns> A new datagram channel /// </returns> /// <exception cref="IOException"> /// If an I/O error occurs </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static DatagramChannel open() throws java.io.IOException public static DatagramChannel Open() { return(SelectorProvider.Provider().OpenDatagramChannel()); }
/// <summary> /// Initializes a new instance of this class. /// </summary> /// <param name="provider"> /// The provider that created this channel </param> protected internal DatagramChannel(SelectorProvider provider) : base(provider) { }