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

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/enterprise/concurrent/managedexecutors.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com/en/java/, Class ManagedExecutors

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.