/** Create a SelectChannel connector. * This methods adds a select channel connector to the server * @return A URL to access the server via the connector. * @throws Exception */ public String createChannelConnector(boolean localhost) throws Exception { synchronized (this) { SelectChannelConnector connector = new SelectChannelConnector(); if (localhost) connector.setHost("127.0.0.1"); _server.addConnector(connector); if (_server.isStarted()) connector.start(); else connector.open(); return "http://"+(localhost?"127.0.0.1": InetAddress.getLocalHost().getHostAddress() )+":"+connector.getLocalPort(); } }
@Override public void open() throws IOException { synchronized(this) { try { Channel channel = System.inheritedChannel(); if ( channel instanceof ServerSocketChannel ) _acceptChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort()); if ( _acceptChannel != null ) _acceptChannel.configureBlocking(true); } catch(NoSuchMethodError e) { LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd."); } if (_acceptChannel == null) super.open(); } }
@Override public void open() throws IOException { synchronized(this) { try { Channel channel = System.inheritedChannel(); if ( channel instanceof ServerSocketChannel ) _acceptChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort()); if ( _acceptChannel != null ) _acceptChannel.configureBlocking(true); } catch(NoSuchMethodError e) { LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd."); } if (_acceptChannel == null) super.open(); } }
@Override public void open() throws IOException { synchronized(this) { try { Channel channel = System.inheritedChannel(); if ( channel instanceof ServerSocketChannel ) _acceptChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort()); if ( _acceptChannel != null ) _acceptChannel.configureBlocking(true); } catch(NoSuchMethodError e) { LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd."); } if (_acceptChannel == null) super.open(); } }
@Override public void open() throws IOException { synchronized(this) { try { Channel channel = System.inheritedChannel(); if ( channel instanceof ServerSocketChannel ) _acceptChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort()); if ( _acceptChannel != null ) _acceptChannel.configureBlocking(true); } catch(NoSuchMethodError e) { LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd."); } if (_acceptChannel == null) super.open(); } }
@Override public void open() throws IOException { synchronized(this) { try { Channel channel = System.inheritedChannel(); if ( channel instanceof ServerSocketChannel ) _acceptChannel = (ServerSocketChannel)channel; else LOG.warn("Unable to use System.inheritedChannel() [" +channel+ "]. Trying a new ServerSocketChannel at " + getHost() + ":" + getPort()); if ( _acceptChannel != null ) _acceptChannel.configureBlocking(true); } catch(NoSuchMethodError e) { LOG.warn("Need at least Java 5 to use socket inherited from xinetd/inetd."); } if (_acceptChannel == null) super.open(); } }