-
public interface ManagedTask
A task submitted to anManagedExecutorService
orManagedScheduledExecutorService
can optionally implement this interface to provide identifying information about the task, to provide aManagedTaskListener
to get notification of lifecycle events of the task, or to provide additional execution properties.See also
ManagedExecutors.managedTask()
.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field and Description static String
IDENTITY_NAME
Execution property to be returned ingetExecutionProperties()
orContextService.createContextualProxy()
to provide a String that identifies the task.static String
LONGRUNNING_HINT
Execution property to be returned ingetExecutionProperties()
orContextService.createContextualProxy()
to provide hint about whether the task could take a long time to complete.static String
SUSPEND
Constant for the "SUSPEND" value of the TRANSACTION execution property.static String
TRANSACTION
Execution property to be returned ingetExecutionProperties()
orContextService.createContextualProxy()
to inform the Java™ EE Product Provider under which transaction should the task or proxy method of contextual proxy object be executed in.static String
USE_TRANSACTION_OF_EXECUTION_THREAD
Constant for the "USE_TRANSACTION_OF_EXECUTION_THREAD" value of the TRANSACTION execution property.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Map<String,String>
getExecutionProperties()
Provides additional information to theManagedExecutorService
orManagedScheduledExecutorService
when executing this task.ManagedTaskListener
getManagedTaskListener()
TheManagedTaskListener
to receive notification of lifecycle events of this task.
-
-
-
Field Detail
-
LONGRUNNING_HINT
static final String LONGRUNNING_HINT
Execution property to be returned ingetExecutionProperties()
orContextService.createContextualProxy()
to provide hint about whether the task could take a long time to complete. Java™ EE Product Providers may make use of this hint value to decide how to allocate thread resource for running this task. Valid values are "true" or "false".- See Also:
- Constant Field Values
-
TRANSACTION
static final String TRANSACTION
Execution property to be returned ingetExecutionProperties()
orContextService.createContextualProxy()
to inform the Java™ EE Product Provider under which transaction should the task or proxy method of contextual proxy object be executed in. Valid values are:"SUSPEND" (the default if unspecified) - Any transaction that is currently active on the thread will be suspended and a
UserTransaction
(accessible in the local JNDI namespace as "java:comp/UserTransaction") will be available. The original transaction, if any was active on the thread, will be resumed when the task or contextual proxy object method returns."USE_TRANSACTION_OF_EXECUTION_THREAD" - The contextual proxy object method will run within the transaction (if any) of the execution thread. A
UserTransaction
will only be available if it is also available in the execution thread (for example, when the proxy method is invoked from a Servlet or Bean Managed Transaction EJB). When there is no existing transaction on the execution thread, such as when running tasks that are submitted to aManagedExecutorService
or aManagedScheduledExecutorService
, aUserTransaction
will be available.- See Also:
- Constant Field Values
-
SUSPEND
static final String SUSPEND
Constant for the "SUSPEND" value of the TRANSACTION execution property. SeeTRANSACTION
.- See Also:
- Constant Field Values
-
USE_TRANSACTION_OF_EXECUTION_THREAD
static final String USE_TRANSACTION_OF_EXECUTION_THREAD
Constant for the "USE_TRANSACTION_OF_EXECUTION_THREAD" value of the TRANSACTION execution property. SeeTRANSACTION
.- See Also:
- Constant Field Values
-
IDENTITY_NAME
static final String IDENTITY_NAME
Execution property to be returned ingetExecutionProperties()
orContextService.createContextualProxy()
to provide a String that identifies the task. It may be the name or ID that allow management facilities to inspect the task to determine the intent of the task and its state. Implementations should not depend upon any thread execution context and should typically return only readily-available instance data to identify the task.- See Also:
- Constant Field Values
-
-
Method Detail
-
getManagedTaskListener
ManagedTaskListener getManagedTaskListener()
TheManagedTaskListener
to receive notification of lifecycle events of this task.- Returns:
- The
ManagedTaskListener
to receive notification of lifecycle events of this task, or null if it is not necessary to get notified of such events.
-
getExecutionProperties
Map<String,String> getExecutionProperties()
Provides additional information to theManagedExecutorService
orManagedScheduledExecutorService
when executing this task.Some standard property keys are defined in this class. Custom property keys may be defined but must not begin with "javax.enterprise.concurrent.".
- Returns:
- A Map<String, String> containing additional execution properties, or null if no additional information is provided for this task.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/enterprise/concurrent/ManagedTask.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.