Class DefaultManagedAwareThreadFactory

All Implemented Interfaces:
Serializable, ThreadFactory, InitializingBean

public class DefaultManagedAwareThreadFactory extends CustomizableThreadFactory implements InitializingBean
JNDI-based variant of CustomizableThreadFactory, performing a default lookup for JSR-236's "java:comp/DefaultManagedThreadFactory" in a Jakarta EE environment, falling back to the local CustomizableThreadFactory setup if not found.

This is a convenient way to use managed threads when running in a Jakarta EE environment, simply using regular local threads otherwise - without conditional setup (i.e. without profiles).

Note: This class is not strictly JSR-236 based; it can work with any regular ThreadFactory that can be found in JNDI. Therefore, the default JNDI name "java:comp/DefaultManagedThreadFactory" can be customized through the "jndiName" bean property.

Since:
4.0
Author:
Juergen Hoeller
See Also: