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
java. that can be found in JNDI. Therefore,
the default JNDI name "java:comp/DefaultManagedThreadFactory" can be customized
through the "jndiName" bean property.
| Modifier and Type | Field and Description |
|---|---|
| private final JndiLocatorDelegate | |
| private String | |
| protected final Log | |
| private ThreadFactory |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| public Thread | newThread(Runnable
a runnable to be executed by new thread instance runnable)Overrides org. Implements java. Constructs a new unstarted |
| public void | |
| public void | setJndiName(String jndiName)
Specify a JNDI name of the |
| public void | |
| public void | setResourceRef(boolean resourceRef)
Set whether the lookup occurs in a Jakarta EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI name doesn't already contain it. |
| jndiLocator | back to summary |
|---|---|
| private final JndiLocatorDelegate jndiLocator | |
| jndiName | back to summary |
|---|---|
| private String jndiName
| |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| threadFactory | back to summary |
|---|---|
| private ThreadFactory threadFactory
| |
| DefaultManagedAwareThreadFactory | back to summary |
|---|---|
| public DefaultManagedAwareThreadFactory() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() throws NamingException Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
| |
| newThread | back to summary |
|---|---|
| public Thread newThread(Runnable runnable) Overrides org. Implements java. Doc from java. Constructs a new unstarted | |
| setJndiEnvironment | back to summary |
|---|---|
| public void setJndiEnvironment(Properties jndiEnvironment) Set the JNDI environment to use for JNDI lookups. | |
| setJndiName | back to summary |
|---|---|
| public void setJndiName(String jndiName) Specify a JNDI name of the This can either be a fully qualified JNDI name, or the JNDI name relative to the current environment naming context if "resourceRef" is set to "true".
| |
| setJndiTemplate | back to summary |
|---|---|
| public void setJndiTemplate(JndiTemplate jndiTemplate) Set the JNDI template to use for JNDI lookups. | |
| setResourceRef | back to summary |
|---|---|
| public void setResourceRef(boolean resourceRef) Set whether the lookup occurs in a Jakarta EE container, i.e. if the prefix "java:comp/env/" needs to be added if the JNDI name doesn't already contain it. PersistenceAnnotationBeanPostProcessor's default is "true". | |