Package org.jboss.as.threads
Class HandoffExecutorResolver.AbstractThreadFactoryResolver
java.lang.Object
org.jboss.as.threads.HandoffExecutorResolver.AbstractThreadFactoryResolver
- All Implemented Interfaces:
HandoffExecutorResolver
- Direct Known Subclasses:
HandoffExecutorResolver.SimpleResolver
- Enclosing interface:
- HandoffExecutorResolver
public abstract static class HandoffExecutorResolver.AbstractThreadFactoryResolver
extends Object
implements HandoffExecutorResolver
Base class for
ThreadFactoryResolver implementations that handles the case of a null
threadFactoryName by installing a ThreadFactoryService whose service name is
the service name of the thread pool with thread-factory appended.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.as.threads.HandoffExecutorResolver
HandoffExecutorResolver.AbstractThreadFactoryResolver, HandoffExecutorResolver.SimpleResolver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidreleaseDefaultHandoffExecutor(org.jboss.msc.service.ServiceName threadPoolServiceName, OperationContext context) Removes any default thread factory installed inresolveDefaultHandoffExecutor(String, org.jboss.msc.service.ServiceName, org.jboss.msc.service.ServiceTarget).voidreleaseHandoffExecutor(String handoffExecutorName, String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName, OperationContext context) Releases the handoff executor, doing any necessary cleanup, such as removing a default executor that was installed byHandoffExecutorResolver.resolveHandoffExecutor(String, String, org.jboss.msc.service.ServiceName, org.jboss.msc.service.ServiceTarget).protected voidreleaseNamedHandoffExecutor(String handoffExecutorName, String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName, OperationContext context) Handles the work ofreleaseHandoffExecutor(String, String, ServiceName, OperationContext)for the case wherethreadFactoryNameis notnull.protected org.jboss.msc.service.ServiceNameresolveDefaultHandoffExecutor(String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName, org.jboss.msc.service.ServiceTarget serviceTarget) Optionally provides the service name of a default handoff executor.org.jboss.msc.service.ServiceNameresolveHandoffExecutor(String handoffExecutorName, String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName, org.jboss.msc.service.ServiceTarget serviceTarget) Resolves the service name of the handoff executor a thread pool service should use, optionally providing a default executor in case the thread pool does not have a specifically configured handoff executor.protected abstract org.jboss.msc.service.ServiceNameresolveNamedHandoffExecutor(String handoffExecutorName, String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName) Create a service name to use for the thread factory in the case where a simple name for the factory was provided.
-
Constructor Details
-
AbstractThreadFactoryResolver
public AbstractThreadFactoryResolver()
-
-
Method Details
-
resolveHandoffExecutor
public org.jboss.msc.service.ServiceName resolveHandoffExecutor(String handoffExecutorName, String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName, org.jboss.msc.service.ServiceTarget serviceTarget) Description copied from interface:HandoffExecutorResolverResolves the service name of the handoff executor a thread pool service should use, optionally providing a default executor in case the thread pool does not have a specifically configured handoff executor.- Specified by:
resolveHandoffExecutorin interfaceHandoffExecutorResolver- Parameters:
handoffExecutorName- the simple name of the handoff executor. Typically a reference value from the thread pool resource's configuration. Can benullin which case a default handoff executor may be returned.threadPoolName- the name of the thread poolthreadPoolServiceName- the full name of theServicethat provides the thread poolserviceTarget- service target that is installing the thread pool service; can be used to install aThreadFactoryService- Returns:
- the
ServiceNameof the executor service the thread pool should use. May be {@link null}
-
releaseHandoffExecutor
public void releaseHandoffExecutor(String handoffExecutorName, String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName, OperationContext context) Description copied from interface:HandoffExecutorResolverReleases the handoff executor, doing any necessary cleanup, such as removing a default executor that was installed byHandoffExecutorResolver.resolveHandoffExecutor(String, String, org.jboss.msc.service.ServiceName, org.jboss.msc.service.ServiceTarget).- Specified by:
releaseHandoffExecutorin interfaceHandoffExecutorResolver- Parameters:
handoffExecutorName- the simple name of the thread factory. Typically a reference value from the thread pool resource's configuration. Can benullin which case a default thread factory should be released.threadPoolName- the name of the thread poolthreadPoolServiceName- the full name of theServicethat provides the thread poolcontext- the context of the current operation; can be used to perform any necessaryservice removals
-
resolveNamedHandoffExecutor
protected abstract org.jboss.msc.service.ServiceName resolveNamedHandoffExecutor(String handoffExecutorName, String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName) Create a service name to use for the thread factory in the case where a simple name for the factory was provided.- Parameters:
handoffExecutorName- the simple name of the thread factory. Will not benullthreadPoolName- the simple name of the related thread poolthreadPoolServiceName- the full service name of the thread pool- Returns:
- the
ServiceNameof theThreadFactoryServicethe thread pool should use. Cannot benull
-
releaseNamedHandoffExecutor
protected void releaseNamedHandoffExecutor(String handoffExecutorName, String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName, OperationContext context) Handles the work ofreleaseHandoffExecutor(String, String, ServiceName, OperationContext)for the case wherethreadFactoryNameis notnull. This default implementation does nothing, assuming the thread factory is independently managed from the pool.- Parameters:
handoffExecutorName- the simple name of the thread factory. Will not benullthreadPoolName- the simple name of the related thread poolthreadPoolServiceName- the full service name of the thread poolcontext- the context of the current operation; can be used to perform any necessaryservice removals
-
resolveDefaultHandoffExecutor
protected org.jboss.msc.service.ServiceName resolveDefaultHandoffExecutor(String threadPoolName, org.jboss.msc.service.ServiceName threadPoolServiceName, org.jboss.msc.service.ServiceTarget serviceTarget) Optionally provides the service name of a default handoff executor. This implementation simply returnsnull, meaning there is no default.- Parameters:
threadPoolName- the name of the thread poolthreadPoolServiceName- the full name of theServicethat provides the thread poolserviceTarget- service target that is installing the thread pool service; can be used to install aThreadFactoryService- Returns:
- the
ServiceNameof theThreadFactoryServicethe thread pool should use. May benull
-
releaseDefaultHandoffExecutor
protected void releaseDefaultHandoffExecutor(org.jboss.msc.service.ServiceName threadPoolServiceName, OperationContext context) Removes any default thread factory installed inresolveDefaultHandoffExecutor(String, org.jboss.msc.service.ServiceName, org.jboss.msc.service.ServiceTarget). This default implementation does nothing, but any subclass that installs a default service should override this method to remove it.- Parameters:
threadPoolServiceName- the full name of theServicethat provides the thread poolcontext- the context of the current operation; can be used to perform any necessaryservice removals
-