/** * Creates a new HttpNettyClient * @param executor An executor; it is the caller's responsibility to shut it down * @param requestTimeout Timeout, in ms, to get a connection from the pool or create one * @param shutdownTimeout Timeout, in ms, the client should wait after shutdown is * initiated before terminating outstanding requests * @param jmxManager A management class that is aware of the creation/shutdown event * of the underlying {@link ChannelPoolManager} * @param channelPoolManager channelPoolManager instance to retrieve http only channels * @param sslChannelPoolManager channelPoolManager instance to retrieve https only connection */ public AbstractNettyClient(ScheduledExecutorService executor, long requestTimeout, long shutdownTimeout, AbstractJmxManager jmxManager, ChannelPoolManager channelPoolManager, ChannelPoolManager sslChannelPoolManager) { _scheduler = executor; _requestTimeout = requestTimeout; _shutdownTimeout = shutdownTimeout; _jmxManager = jmxManager; _channelPoolManager = channelPoolManager; _sslChannelPoolManager = sslChannelPoolManager; _jmxManager.onProviderCreate(_channelPoolManager); _jmxManager.onProviderCreate(_sslChannelPoolManager); }
() -> _state.set(State.SHUTDOWN), _shutdownTimeout); _jmxManager.onProviderShutdown(_channelPoolManager); _jmxManager.onProviderShutdown(_sslChannelPoolManager); } else { callback.onError(new IllegalStateException("Shutdown has already been requested."));
public AbstractNettyClient(ChannelPoolFactory factory, ScheduledExecutorService executor, int requestTimeout, int shutdownTimeout) { _scheduler = executor; _requestTimeout = requestTimeout; _shutdownTimeout = shutdownTimeout; _jmxManager = AbstractJmxManager.NULL_JMX_MANAGER; DefaultChannelGroup allChannels = new DefaultChannelGroup("R2 client channels", GlobalEventExecutor.INSTANCE); _channelPoolManager = new ChannelPoolManagerImpl(factory, allChannels, _scheduler); // test client doesn't support ssl connections _sslChannelPoolManager = _channelPoolManager; _jmxManager.onProviderCreate(_channelPoolManager); }