org.glassfish.jersey.spi
Interface RequestExecutorProvider


@Contract
public interface RequestExecutorProvider

Pluggable provider of executor service instance used to run different parts of Jersey request and response processing code.

During Jersey runtime initialization, Jersey invokes the registered executor provider to get the requesting executor that will be used to run the request pre-processing and request-to-response transformation code.

The custom provider implementing this interface should be registered in the standard way on the server. The client must be created with configuration containing the provider, later registrations will be ignored.

Author:
Marek Potociar (marek.potociar at oracle.com), Miroslav Fuksa (miroslav.fuksa at oracle.com)

Method Summary
 ExecutorService getRequestingExecutor()
          Get request processing executor.
 void releaseRequestingExecutor(ExecutorService executor)
          Release the executor previously retrieved via getRequestingExecutor() call.
 

Method Detail

getRequestingExecutor

ExecutorService getRequestingExecutor()
Get request processing executor. This method is called only once at Jersey initialization, before the first request is processed.

Returns:
request processing executor. Must not return null.

releaseRequestingExecutor

void releaseRequestingExecutor(ExecutorService executor)
Release the executor previously retrieved via getRequestingExecutor() call. This method is called when the Jersey runtime does not need the executor anymore. After this method has been called, the executor will not be used by the Jersey runtime anymore.

The decision how the executor is released is left upon the provider implementation. In most typical scenarios, the executor may be simply shutdown. However in cases when the provider is implemented to re-use same executors across multiple components or Jersey runtimes, the executor release logic may require more sophisticated implementation.

Parameters:
executor - executor instance to be released.
Since:
2.5


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.