/** * <p>Registers a channel to perform non-blocking read/write operations.</p> * <p>This method is called just after a channel has been accepted by {@link ServerSocketChannel#accept()}, * or just after having performed a blocking connect via {@link Socket#connect(SocketAddress, int)}.</p> * * @param channel the channel to register */ public void accept(final SocketChannel channel) { final ManagedSelector selector = chooseSelector(); selector.submit(selector.new Accept(channel)); }
/** * <p>Registers a channel to perform a non-blocking connect.</p> * <p>The channel must be set in non-blocking mode, and {@link SocketChannel#connect(SocketAddress)} * must be called prior to calling this method.</p> * * @param channel the channel to register * @param attachment the attachment object */ public void connect(SocketChannel channel, Object attachment) { ManagedSelector set = chooseSelector(); set.submit(set.new Connect(channel, attachment)); }
/** * <p>Registers a channel to perform non-blocking read/write operations.</p> * <p>This method is called just after a channel has been accepted by {@link ServerSocketChannel#accept()}, * or just after having performed a blocking connect via {@link Socket#connect(SocketAddress, int)}.</p> * * @param channel the channel to register */ public void accept(final SocketChannel channel) { final ManagedSelector selector = chooseSelector(); selector.submit(selector.new Accept(channel)); }
/** * <p>Registers a channel to perform a non-blocking connect.</p> * <p>The channel must be set in non-blocking mode, and {@link SocketChannel#connect(SocketAddress)} * must be called prior to calling this method.</p> * * @param channel the channel to register * @param attachment the attachment object */ public void connect(SocketChannel channel, Object attachment) { ManagedSelector set = chooseSelector(); set.submit(set.new Connect(channel, attachment)); }
/** * <p>Registers a channel to perform non-blocking read/write operations.</p> * <p>This method is called just after a channel has been accepted by {@link ServerSocketChannel#accept()}, * or just after having performed a blocking connect via {@link Socket#connect(SocketAddress, int)}, or * just after a non-blocking connect via {@link SocketChannel#connect(SocketAddress)} that completed * successfully.</p> * * @param channel the channel to register * @param attachment the attachment object */ public void accept(SocketChannel channel, Object attachment) { final ManagedSelector selector = chooseSelector(channel); selector.submit(selector.new Accept(channel, attachment)); }
/** * <p>Registers a server channel for accept operations. * When a {@link SocketChannel} is accepted from the given {@link ServerSocketChannel} * then the {@link #accepted(SocketChannel)} method is called, which must be * overridden by a derivation of this class to handle the accepted channel * * @param server the server channel to register */ public void acceptor(ServerSocketChannel server) { final ManagedSelector selector = chooseSelector(); selector.submit(selector.new Acceptor(server)); }
/** * <p>Registers a server channel for accept operations. * When a {@link SocketChannel} is accepted from the given {@link ServerSocketChannel} * then the {@link #accepted(SocketChannel)} method is called, which must be * overridden by a derivation of this class to handle the accepted channel * * @param server the server channel to register */ public void acceptor(ServerSocketChannel server) { final ManagedSelector selector = chooseSelector(null); selector.submit(selector.new Acceptor(server)); }
/** * <p>Registers a channel to perform a non-blocking connect.</p> * <p>The channel must be set in non-blocking mode, {@link SocketChannel#connect(SocketAddress)} * must be called prior to calling this method, and the connect operation must not be completed * (the return value of {@link SocketChannel#connect(SocketAddress)} must be false).</p> * * @param channel the channel to register * @param attachment the attachment object * @see #accept(SelectableChannel, Object) */ public void connect(SelectableChannel channel, Object attachment) { ManagedSelector set = chooseSelector(); set.submit(set.new Connect(channel, attachment)); }
/** * <p>Registers a server channel for accept operations. * When a {@link SocketChannel} is accepted from the given {@link ServerSocketChannel} * then the {@link #accepted(SelectableChannel)} method is called, which must be * overridden by a derivation of this class to handle the accepted channel * * @param server the server channel to register * @return A Closable that allows the acceptor to be cancelled */ public Closeable acceptor(SelectableChannel server) { final ManagedSelector selector = chooseSelector(); ManagedSelector.Acceptor acceptor = selector.new Acceptor(server); selector.submit(acceptor); return acceptor; }
/** * <p>Registers a channel to perform non-blocking read/write operations.</p> * <p>This method is called just after a channel has been accepted by {@link ServerSocketChannel#accept()}, * or just after having performed a blocking connect via {@link Socket#connect(SocketAddress, int)}, or * just after a non-blocking connect via {@link SocketChannel#connect(SocketAddress)} that completed * successfully.</p> * * @param channel the channel to register * @param attachment the attachment object */ public void accept(SelectableChannel channel, Object attachment) { final ManagedSelector selector = chooseSelector(); selector.submit(selector.new Accept(channel, attachment)); }
/** * <p>Registers a channel to perform non-blocking read/write operations.</p> * <p>This method is called just after a channel has been accepted by {@link ServerSocketChannel#accept()}, * or just after having performed a blocking connect via {@link Socket#connect(SocketAddress, int)}, or * just after a non-blocking connect via {@link SocketChannel#connect(SocketAddress)} that completed * successfully.</p> * * @param channel the channel to register * @param attachment the attachment object */ public void accept(SelectableChannel channel, Object attachment) { final ManagedSelector selector = chooseSelector(); selector.submit(selector.new Accept(channel, attachment)); }
/** * <p>Registers a channel to perform a non-blocking connect.</p> * <p>The channel must be set in non-blocking mode, {@link SocketChannel#connect(SocketAddress)} * must be called prior to calling this method, and the connect operation must not be completed * (the return value of {@link SocketChannel#connect(SocketAddress)} must be false).</p> * * @param channel the channel to register * @param attachment the attachment object * @see #accept(SocketChannel, Object) */ public void connect(SocketChannel channel, Object attachment) { ManagedSelector set = chooseSelector(channel); set.submit(set.new Connect(channel, attachment)); }
/** * <p>Registers a channel to perform a non-blocking connect.</p> * <p>The channel must be set in non-blocking mode, {@link SocketChannel#connect(SocketAddress)} * must be called prior to calling this method, and the connect operation must not be completed * (the return value of {@link SocketChannel#connect(SocketAddress)} must be false).</p> * * @param channel the channel to register * @param attachment the attachment object * @see #accept(SelectableChannel, Object) */ public void connect(SelectableChannel channel, Object attachment) { ManagedSelector set = chooseSelector(); set.submit(set.new Connect(channel, attachment)); }
/** * <p>Registers a channel to perform a non-blocking connect.</p> * <p>The channel must be set in non-blocking mode, {@link SocketChannel#connect(SocketAddress)} * must be called prior to calling this method, and the connect operation must not be completed * (the return value of {@link SocketChannel#connect(SocketAddress)} must be false).</p> * * @param channel the channel to register * @param attachment the attachment object * @see #accept(SocketChannel, Object) */ public void connect(SocketChannel channel, Object attachment) { ManagedSelector set = chooseSelector(); set.submit(set.new Connect(channel, attachment)); }
/** * <p>Registers a channel to perform non-blocking read/write operations.</p> * <p>This method is called just after a channel has been accepted by {@link ServerSocketChannel#accept()}, * or just after having performed a blocking connect via {@link Socket#connect(SocketAddress, int)}, or * just after a non-blocking connect via {@link SocketChannel#connect(SocketAddress)} that completed * successfully.</p> * * @param channel the channel to register * @param attachment the attachment object */ public void accept(SocketChannel channel, Object attachment) { final ManagedSelector selector = chooseSelector(); selector.submit(selector.new Accept(channel, attachment)); }
/** * <p>Registers a server channel for accept operations. * When a {@link SocketChannel} is accepted from the given {@link ServerSocketChannel} * then the {@link #accepted(SelectableChannel)} method is called, which must be * overridden by a derivation of this class to handle the accepted channel * * @param server the server channel to register * @return A Closable that allows the acceptor to be cancelled */ public Closeable acceptor(SelectableChannel server) { final ManagedSelector selector = chooseSelector(); ManagedSelector.Acceptor acceptor = selector.new Acceptor(server); selector.submit(acceptor); return acceptor; }