org.springframework.scheduling.concurrent

## Class DefaultManagedTaskScheduler

- java.lang.Object
- - org.springframework.scheduling.concurrent.ConcurrentTaskExecutor
  - - org.springframework.scheduling.concurrent.ConcurrentTaskScheduler
    - - org.springframework.scheduling.concurrent.DefaultManagedTaskScheduler

- All Implemented Interfaces:
    Executor, InitializingBean, AsyncListenableTaskExecutor, AsyncTaskExecutor, TaskExecutor, SchedulingTaskExecutor, TaskScheduler

      public class DefaultManagedTaskScheduler
      extends ConcurrentTaskScheduler
      implements InitializingBean

  JNDI-based variant of `ConcurrentTaskScheduler`, performing a default lookup for JSR-236's "java:comp/DefaultManagedScheduledExecutorService" in a Java EE 7 environment.

  Note: This class is not strictly JSR-236 based; it can work with any regular `ScheduledExecutorService` that can be found in JNDI. The actual adapting to `ManagedScheduledExecutorService` happens in the base class `ConcurrentTaskScheduler` itself.

  Since:
    4.0
  Author:
    Juergen Hoeller
  See Also:
    `ManagedScheduledExecutorService`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.springframework.scheduling.concurrent.ConcurrentTaskExecutor

      `ConcurrentTaskExecutor.ManagedTaskBuilder`

  - ### Field Summary

    - ### Fields inherited from interface org.springframework.core.task.AsyncTaskExecutor

      `TIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultManagedTaskScheduler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()` Invoked by the containing `BeanFactory` after it has set all bean properties and satisfied `BeanFactoryAware`, `ApplicationContextAware` etc.
    `void` | `setJndiEnvironment(Properties jndiEnvironment)` Set the JNDI environment to use for JNDI lookups.
    `void` | `setJndiName(String jndiName)` Specify a JNDI name of the `Executor` to delegate to, replacing the default JNDI name "java:comp/DefaultManagedScheduledExecutorService".
    `void` | `setJndiTemplate(JndiTemplate jndiTemplate)` Set the JNDI template to use for JNDI lookups.
    `void` | `setResourceRef(boolean resourceRef)` Set whether the lookup occurs in a Java EE container, i.e.

    - ### Methods inherited from class org.springframework.scheduling.concurrent.ConcurrentTaskScheduler

      `getClock, schedule, schedule, scheduleAtFixedRate, scheduleAtFixedRate, scheduleWithFixedDelay, scheduleWithFixedDelay, setClock, setErrorHandler, setScheduledExecutor`

    - ### Methods inherited from class org.springframework.scheduling.concurrent.ConcurrentTaskExecutor

      `execute, execute, getConcurrentExecutor, setConcurrentExecutor, setTaskDecorator, submit, submit, submitListenable, submitListenable`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.springframework.scheduling.TaskScheduler

      `schedule, scheduleAtFixedRate, scheduleAtFixedRate, scheduleWithFixedDelay, scheduleWithFixedDelay`

    - ### Methods inherited from interface org.springframework.scheduling.SchedulingTaskExecutor

      `prefersShortLivedTasks`

- - ### Constructor Detail

    - #### DefaultManagedTaskScheduler

          public DefaultManagedTaskScheduler()

  - ### Method Detail

    - #### setJndiTemplate

          public void setJndiTemplate(JndiTemplate jndiTemplate)

      Set the JNDI template to use for JNDI lookups.
      See Also:
        `JndiAccessor.setJndiTemplate(org.springframework.jndi.JndiTemplate)`

    - #### setJndiEnvironment

          public void setJndiEnvironment(Properties jndiEnvironment)

      Set the JNDI environment to use for JNDI lookups.
      See Also:
        `JndiAccessor.setJndiEnvironment(java.util.Properties)`

    - #### setResourceRef

          public void setResourceRef(boolean resourceRef)

      Set whether the lookup occurs in a Java 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".
      See Also:
        `JndiLocatorSupport.setResourceRef(boolean)`

    - #### setJndiName

          public void setJndiName(String jndiName)

      Specify a JNDI name of the `Executor` to delegate to, replacing the default JNDI name "java:comp/DefaultManagedScheduledExecutorService".

      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".

      See Also:
        `ConcurrentTaskExecutor.setConcurrentExecutor(java.util.concurrent.Executor)`, `setResourceRef(boolean)`

    - #### afterPropertiesSet

          public void afterPropertiesSet()
                                  throws NamingException

      Description copied from interface: `InitializingBean`
      Invoked by the containing `BeanFactory` after it has set all bean properties and satisfied `BeanFactoryAware`, `ApplicationContextAware` etc.

      This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

      Specified by:
        `afterPropertiesSet` in interface `InitializingBean`
      Throws:
        `NamingException`