Java Code Examples for java.nio.channels.ServerSocketChannel#isOpen()
The following examples show how to use
java.nio.channels.ServerSocketChannel#isOpen() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandardServerChannelFactory.java From yajsync with GNU General Public License v3.0 | 6 votes |
@Override public ServerChannel open(InetAddress address, int port, int timeout) throws IOException { ServerSocketChannel sock = ServerSocketChannel.open(); try { if (_isReuseAddress) { sock.setOption(StandardSocketOptions.SO_REUSEADDR, true); } InetSocketAddress socketAddress = new InetSocketAddress(address, port); sock.bind(socketAddress); return new StandardServerChannel(sock, timeout); } catch (Throwable t) { try { if (sock.isOpen()) { sock.close(); } } catch (Throwable tt) { t.addSuppressed(tt); } throw t; } }
Example 2
Source File: VirtualNonBlockingServerChannelSelector.java From BiglyBT with GNU General Public License v2.0 | 5 votes |
/** * Is this selector actively running * @return true if enabled, false if not running */ @Override public boolean isRunning() { if ( server_channels.size() == 0 ){ return( false); } ServerSocketChannel server_channel = (ServerSocketChannel)server_channels.get(0); if( server_channel != null && server_channel.isOpen() ) return true; return false; }