en.help.task-managedscheduledexecutorservicecreate.html Maven / Gradle / Ivy
To Create a Managed Scheduled Executor Service
A managed scheduled executor service is used by applications to execute submitted tasks asynchronously at specific times. Tasks are executed on threads that are started and managed by the container. The context of the container is propagated to the thread executing the task.
In GlassFish Server, you configure a managed scheduled executor service resource and make it available for use by application components such as servlets and EJBs. The actual scheduling of tasks is implemented programmatically by the applications.
-
In the navigation tree, expand the Resources node.
-
Under the Resources node, expand the Concurrent Resources node.
-
Under the Concurrent Resources node, select Managed Scheduled Executor Services.
The Managed Scheduled Executor Services page opens.
-
On the Managed Scheduled Executor Services page, click New.
The New Managed Scheduled Executor Service page opens.
-
In the JNDI Name field, type a unique name that identifies the resource.
The JNDI name is registered in the JNDI naming service and used by applications to look up the resource. Use the concurrent/
name format. For example, concurrent/myManagedScheduledExecutorService
. The name can contain only alphanumeric, underscore, dash, or dot characters.
-
Select the Context Information Enabled checkbox to propagate contexts to threads, and select the contexts that you want to propagate.
This option is enabled and all contexts are selected by default. Use Shift-click or Control-click to choose multiple contexts. If this option is disabled, contexts are not propagated, even if they are selected.
-
Select the Status Enabled checkbox to enable the resource.
This option is enabled by default, which means that the resource is available as soon as it is created.
-
In the Thread Priority field, type the priority to assign to created threads.
The default value is 5.
-
Select the Long-Running Tasks Enabled checkbox to use the resource to run long-running tasks.
If enabled, long-running tasks are not reported as stuck. This option is disabled by default.
-
In the Hung After field, type the number of seconds tasks can execute before they are considered unresponsive.
The default value is 0, which means that tasks are never considered unresponsive.
-
In the Description field, type a short description of the resource.
This description is a string value and can include a maximum of 250 characters.
-
In the Core Size field, type the number of threads to keep in a thread pool, even if they are idle.
The default value is 0, which means that a thread is created when the first task is scheduled.
-
In the Keep Alive field, type the number of seconds threads can remain idle when the number of threads is greater than core size.
The default value is 60.
-
In the Thread Lifetime field, type the number of seconds threads can remain in a thread pool before being purged, regardless of whether the number of threads is greater than core size or whether the threads are idle.
The default value is 0, which means that threads are never purged.
-
In the Additional Properties section, do not add any additional properties.
GlassFish Server does not define any additional properties for this resource type. Moreover, this resource type does not currently use any additional properties.
-
In the Targets section, specify the selected targets for the resource.
Targets are displayed only if clusters and standalone instances have been created in the domain, in addition to the default server instance, server
.
-
Click OK.
See Also
Copyright © 2005, 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices