@ManagedAttribute public synchronized void setHealthState(boolean isHealthy) { if (LOGGER.isInfoEnabled()) { LOGGER.info("setting protocol to " + (isHealthy ? "enabled" : "disabled")); } if (socketAcceptor != null) { CougarProtocol cougarProtocol = (CougarProtocol) socketAcceptor.getDefaultConfig().getFilterChain().get("protocol"); cougarProtocol.setEnabled(isHealthy); if (!isHealthy) { shutdownSessions(false); } } }
@ManagedAttribute public synchronized Boolean isHealthState() { if (socketAcceptor != null) { CougarProtocol cougarProtocol = (CougarProtocol) socketAcceptor.getDefaultConfig().getFilterChain().get("protocol"); return cougarProtocol.isEnabled(); } return null; }
@ManagedAttribute public boolean isEnabled() { final CougarProtocol protocol = (CougarProtocol) socketAcceptor.getDefaultConfig().getFilterChain().get("protocol"); if (protocol != null) { return protocol.isEnabled(); } return false; }
private void shutdownSessions(boolean blockUntilComplete) { CougarProtocol cougarProtocol = (CougarProtocol) socketAcceptor.getDefaultConfig().getFilterChain().get("protocol"); sessionManager.shutdownSessions(socketAcceptor.getManagedSessions(socketAddress), cougarProtocol, this.serverHandler, blockUntilComplete); }
new TextLineCodecFactory(Charset.forName("UTF-8"))); SocketAcceptorConfig cfg = new SocketAcceptorConfig(); cfg.getFilterChain().addLast("codec", codec);
private void startNetworking() throws Exception { registry = new SocketAcceptor(); SocketAcceptorConfig config = new SocketAcceptorConfig(); config.setReuseAddress( true ); config.getFilterChain().addLast( "protocol", new ProtocolCodecFilter( new ReplicationServerProtocolCodecFactory() ) ); config.getFilterChain().addLast( "logger", new LoggingFilter() ); // bind server protocol provider registry.bind( new InetSocketAddress( configuration.getServerPort() ), new ReplicationServerProtocolHandler( this ), config ); clientConnectionManager.start( configuration ); }