javax.enterprise.concurrent

Class ManagedExecutors


  • public class ManagedExecutors
    extends Object
    Utility methods for classes defined in this package.
    Since:
    1.0
    • Method Detail

      • isCurrentThreadShutdown

        public static boolean isCurrentThreadShutdown()
        Utility method for checking the isShutdown() value of the current thread if it is a ManageableThread created from ManagedThreadFactory.newThread() .
        Returns:
        Returns the isShutdown() value if the current thread is a ManageableThread created by ManagedThreadFactory, or false if the current thread is not a ManageableThread.
      • managedTask

        public static Runnable managedTask(Runnable task,
                                           ManagedTaskListener taskListener)
                                    throws IllegalArgumentException
        Returns a Runnable object that also implements ManagedTask interface so it can receive notification of lifecycle events with the provided ManagedTaskListener when the task is submitted to a ManagedExecutorService or a ManagedScheduledExecutorService.

        Example:

         Runnable task = ...;
         ManagedTaskListener myTaskListener = ...;
         ManagedExecutorService executor = ...;
         
         Runnable taskWithListener = ManagedExecutors.managedTask(task, myTaskListener);
         executor.submit(taskWithListener);
         
        Parameters:
        task - the task to have the given ManagedTaskListener associated with
        taskListener - (optional) the ManagedTaskListener to receive lifecycle events notification when the task is submitted. If task implements ManagedTask, and taskListener is not null, the ManagedTaskListener interface methods of the task will not be called.
        Returns:
        a Runnable object
        Throws:
        IllegalArgumentException - if task is null
      • managedTask

        public static Runnable managedTask(Runnable task,
                                           Map<String,String> executionProperties,
                                           ManagedTaskListener taskListener)
                                    throws IllegalArgumentException
        Returns a Runnable object that also implements ManagedTask interface so it can receive notification of lifecycle events with the provided ManagedTaskListener and to provide additional execution properties when the task is submitted to a ManagedExecutorService or a ManagedScheduledExecutorService.
        Parameters:
        task - the task to have the given ManagedTaskListener associated with
        taskListener - (optional) the ManagedTaskListener to receive lifecycle events notification when the task is submitted. If task implements ManagedTask, and taskListener is not null, the ManagedTaskListener interface methods of the task will not be called.
        executionProperties - (optional) execution properties to provide additional hints to ManagedExecutorService or ManagedScheduledExecutorService when the task is submitted. If task implements ManagedTask with non-empty execution properties, the Runnable returned will contain the union of the execution properties specified in the task and the executionProperties argument, with the latter taking precedence if the same property key is specified in both. After the method is called, further changes to the Map object will not be reflected in the Runnable returned by this method.
        Returns:
        a Runnable object
        Throws:
        IllegalArgumentException - if task is null
      • managedTask

        public static <V> Callable<V> managedTask(Callable<V> task,
                                                  Map<String,String> executionProperties,
                                                  ManagedTaskListener taskListener)
                                           throws IllegalArgumentException
        Returns a Callable object that also implements ManagedTask interface so it can receive notification of lifecycle events with the provided ManagedTaskListener and to provide additional execution properties when the task is submitted to a ManagedExecutorService or a ManagedScheduledExecutorService.
        Parameters:
        task - the task to have the given ManagedTaskListener associated with
        taskListener - (optional) the ManagedTaskListener to receive lifecycle events notification when the task is submitted. If task implements ManagedTask, and taskListener is not null, the ManagedTaskListener interface methods of the task will not be called.
        executionProperties - (optional) execution properties to provide additional hints to ManagedExecutorService or ManagedScheduledExecutorService when the task is submitted. If task implements ManagedTask with non-empty execution properties, the Runnable returned will contain the union of the execution properties specified in the task and the executionProperties argument, with the latter taking precedence if the same property key is specified in both. After the method is called, further changes to the Map object will not be reflected in the Callable returned by this method.
        Returns:
        a Callable object
        Throws:
        IllegalArgumentException - if task is null

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/08/2025 15:08:20 Cette version de la page est en cache (à la date du 21/08/2025 15:08:20) afin d'accélérer le traitement.
Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.

Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/enterprise/concurrent/ManagedExecutors.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, ManagedExecutors (Java(TM) EE 7 Specification APIs)

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.