org.glassfish.jersey.process.internal
Class ExecutorsFactory<REQUEST>

java.lang.Object
  extended by org.glassfish.jersey.process.internal.ExecutorsFactory<REQUEST>
Type Parameters:
REQUEST - request data type.

@Singleton
public abstract class ExecutorsFactory<REQUEST>
extends Object

Aggregate request executors provider and response executors provider used by client and server-side run-times to provide support for pluggable managed/async executor services.

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

Constructor Summary
ExecutorsFactory(ServiceLocator locator)
          Creates new instance.
 
Method Summary
protected  ExecutorService getInitialRequestingExecutor(RequestExecutorsProvider defaultProvider)
          Convenience method for implementation classes which returns the requesting executor and logs the details into the log.
protected  ExecutorService getInitialRespondingExecutor(ResponseExecutorsProvider defaultProvider)
          Convenience method for implementation classes which returns the responding executor and logs the details into the log.
abstract  ExecutorService getRequestingExecutor(REQUEST request)
          Returns request executor for the given Request.
abstract  ExecutorService getRespondingExecutor(REQUEST request)
          Returns response executor for the given Request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutorsFactory

public ExecutorsFactory(ServiceLocator locator)
Creates new instance.

Parameters:
locator - Injected HK2 locator.
Method Detail

getInitialRequestingExecutor

protected ExecutorService getInitialRequestingExecutor(RequestExecutorsProvider defaultProvider)
Convenience method for implementation classes which returns the requesting executor and logs the details into the log. If there is any custom registered request executor provider its executor will be returned. Otherwise executor of the defaultProvider is returned. The result is logged.

Parameters:
defaultProvider - Default provider which must return not-null executor. This provider will be used if no custom request executor provider is found.
Returns:
Requesting executor.

getInitialRespondingExecutor

protected ExecutorService getInitialRespondingExecutor(ResponseExecutorsProvider defaultProvider)
Convenience method for implementation classes which returns the responding executor and logs the details into the log. If there is any custom registered response executor provider its executor will be returned. Otherwise executor of the defaultProvider is returned. The result is logged.

Parameters:
defaultProvider - Default provider which must return not-null executor. This provider will be used if no custom response executor provider is found.
Returns:
Responding executor.

getRequestingExecutor

public abstract ExecutorService getRequestingExecutor(REQUEST request)
Returns request executor for the given Request. The implementation of the method could return different executor based on the given request data, for example return different executor for asynchronous processing than for synchronous processing.

Parameters:
request - Request object.
Returns:
Request executor which will be used for request processing of the given response.

getRespondingExecutor

public abstract ExecutorService getRespondingExecutor(REQUEST request)
Returns response executor for the given Request. The implementation of the method could return different executor based on the given request data, for example return different executor for asynchronous processing than for synchronous processing.

Parameters:
request - Request object.
Returns:
Response executor which will be used for request processing of the given response.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.