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

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/ManagedExecutors.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

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com, ManagedExecutors (Java(TM) EE 7 Specification APIs)

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.