@SuppressWarnings("unchecked")
    public Future<Boolean> shutdown(long quietPeriod, long timeout, TimeUnit timeUnit) {

        logger.debug("Initiate shutdown ({}, {}, {})", quietPeriod, timeout, timeUnit);

        shutdownCalled = true;
        DefaultPromise<Boolean> overall = new DefaultPromise<Boolean>(GlobalEventExecutor.INSTANCE);
        DefaultPromise<Boolean> lastRelease = new DefaultPromise<Boolean>(GlobalEventExecutor.INSTANCE);
        Futures.PromiseAggregator<Boolean, Promise<Boolean>> aggregator = new Futures.PromiseAggregator<Boolean, Promise<Boolean>>(
                overall);

        aggregator.expectMore(1);

        if (!sharedEventLoopGroupProvider) {
            aggregator.expectMore(1);
        }

        if (!sharedEventExecutor) {
            aggregator.expectMore(1);
        }

        aggregator.arm();

        if (metricEventPublisher != null) {
            metricEventPublisher.shutdown();
        }

        if (!sharedTimer) {
            timer.stop();
        }

        if (!sharedEventLoopGroupProvider) {
            Future<Boolean> shutdown = eventLoopGroupProvider.shutdown(quietPeriod, timeout, timeUnit);
            if (shutdown instanceof Promise) {
                aggregator.add((Promise<Boolean>) shutdown);
            } else {
                aggregator.add(toBooleanPromise(shutdown));
            }
        }

        if (!sharedEventExecutor) {
            Future<?> shutdown = eventExecutorGroup.shutdownGracefully(quietPeriod, timeout, timeUnit);
            aggregator.add(toBooleanPromise(shutdown));
        }

        if (!sharedCommandLatencyCollector) {
            commandLatencyCollector.shutdown();
        }

        aggregator.add(lastRelease);
        lastRelease.setSuccess(null);

        return toBooleanPromise(overall);
    }
@ SuppressWarnings ( "unchecked" ) public Future < Boolean > shutdown ( long quietPeriod , long timeout , TimeUnit timeUnit ) { logger . debug ( "Initiate shutdown ({}, {}, {})" , quietPeriod , timeout , timeUnit ) ; shutdownCalled = true ; DefaultPromise < Boolean > overall = new DefaultPromise < Boolean > ( GlobalEventExecutor . INSTANCE ) ; DefaultPromise < Boolean > lastRelease = new DefaultPromise < Boolean > ( GlobalEventExecutor . INSTANCE ) ; Futures . PromiseAggregator < Boolean , Promise < Boolean > > aggregator = new Futures . PromiseAggregator < Boolean , Promise < Boolean > > ( overall ) ; aggregator . expectMore ( 1 ) ; if ( ! sharedEventLoopGroupProvider ) { aggregator . expectMore ( 1 ) ; } if ( ! sharedEventExecutor ) { aggregator . expectMore ( 1 ) ; } aggregator . arm ( ) ; if ( metricEventPublisher != null ) { metricEventPublisher . shutdown ( ) ; } if ( ! sharedTimer ) { timer . stop ( ) ; } if ( ! sharedEventLoopGroupProvider ) { Future < Boolean > shutdown = eventLoopGroupProvider . shutdown ( quietPeriod , timeout , timeUnit ) ; if ( shutdown instanceof Promise ) { aggregator . add ( ( Promise < Boolean > ) shutdown ) ; } else { aggregator . add ( toBooleanPromise ( shutdown ) ) ; } } if ( ! sharedEventExecutor ) { Future < ? > shutdown = eventExecutorGroup . shutdownGracefully ( quietPeriod , timeout , timeUnit ) ; aggregator . add ( toBooleanPromise ( shutdown ) ) ; } if ( ! sharedCommandLatencyCollector ) { commandLatencyCollector . shutdown ( ) ; } aggregator . add ( lastRelease ) ; lastRelease . setSuccess ( null ) ; return toBooleanPromise ( overall ) ; }
Shutdown the {@link ClientResources}.

@param quietPeriod the quiet period as described in the documentation
@param timeout the maximum amount of time to wait until the executor is shutdown regardless if a task was submitted
during the quiet period
@param timeUnit the unit of {@code quietPeriod} and {@code timeout}
@return eventually the success/failure of the shutdown without errors.