public abstract class RequestExecutorFactory extends Object
Request executors provider aggregator used by
client and server-side run-times to provide support for pluggable managed/async executor services.
Instances of RequestExecutorFactory use the configured request executors provider to
lazily retrieve and cache an instance of request executor service
when getExecutor() method is invoked. The retrieved executor service is then cached and returned
from the getExecutor() method on subsequent calls.
It is expected that the ExecutorFactory's close() method will be called on any
executor factory instance that is no longer use. Upon the call to close() method, the factory
will release the cached
| Constructor and Description |
|---|
RequestExecutorFactory(org.glassfish.hk2.api.ServiceLocator locator,
Object... args)
Creates new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the executor factory and release any associated executor service resources.
|
protected abstract RequestExecutorProvider |
getDefaultProvider(Object... initArgs)
Get the default request executor provider.
|
ExecutorService |
getExecutor()
Get the request processing executor using the underlying
RequestExecutorProvider configured
in the executor factory instance. |
public RequestExecutorFactory(org.glassfish.hk2.api.ServiceLocator locator,
Object... args)
locator - Injected HK2 locator.args - additional arguments that will be passed into the
getDefaultProvider(Object...) when/if invoked.protected abstract RequestExecutorProvider getDefaultProvider(Object... initArgs)
This method is invoked from the RequestExecutorFactory constructor if no custom
RequestExecutorProvider registration is found.
The returned default provider will be then used to provide the default request executor
implementation.
Concrete implementations of this class are expected to provide implementation of this
method. Note that since the method is used from the RequestExecutorFactory constructor,
the implementation of this method must not rely on initialization of any non-static fields
of the overriding sub-class. Instead, the necessary initialization arguments may be passed
via super constructor.
initArgs - initialization arguments passed via
constructor
of this class.public final ExecutorService getExecutor()
RequestExecutorProvider configured
in the executor factory instance.null.IllegalStateException - in case the factory instance has been closed
already.public final void close()
Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.