Tabnine Logo
ManagedExecutors
Code IndexAdd Tabnine to your IDE (free)

How to use
ManagedExecutors
in
javax.enterprise.concurrent

Best Java code snippets using javax.enterprise.concurrent.ManagedExecutors (Showing top 12 results out of 315)

origin: spring-projects/spring-framework

  public static <T> Callable<T> buildManagedTask(Callable<T> task, String identityName) {
    Map<String, String> properties = new HashMap<>(2);
    properties.put(ManagedTask.IDENTITY_NAME, identityName);
    return ManagedExecutors.managedTask(task, properties, null);
  }
}
origin: org.springframework/spring-context

  public static <T> Callable<T> buildManagedTask(Callable<T> task, String identityName) {
    Map<String, String> properties = new HashMap<>(2);
    properties.put(ManagedTask.IDENTITY_NAME, identityName);
    return ManagedExecutors.managedTask(task, properties, null);
  }
}
origin: spring-projects/spring-framework

public static Runnable buildManagedTask(Runnable task, String identityName) {
  Map<String, String> properties;
  if (task instanceof SchedulingAwareRunnable) {
    properties = new HashMap<>(4);
    properties.put(ManagedTask.LONGRUNNING_HINT,
        Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
  }
  else {
    properties = new HashMap<>(2);
  }
  properties.put(ManagedTask.IDENTITY_NAME, identityName);
  return ManagedExecutors.managedTask(task, properties, null);
}
origin: org.springframework/spring-context

public static Runnable buildManagedTask(Runnable task, String identityName) {
  Map<String, String> properties;
  if (task instanceof SchedulingAwareRunnable) {
    properties = new HashMap<>(4);
    properties.put(ManagedTask.LONGRUNNING_HINT,
        Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
  }
  else {
    properties = new HashMap<>(2);
  }
  properties.put(ManagedTask.IDENTITY_NAME, identityName);
  return ManagedExecutors.managedTask(task, properties, null);
}
origin: jakarta.enterprise.concurrent/jakarta.enterprise.concurrent-api

/**
 * Returns a {@link Callable} object that also implements {@link ManagedTask}
 * interface so it can receive notification of lifecycle events with the
 * provided {@link ManagedTaskListener} when the task is submitted 
 * to a {@link ManagedExecutorService} or a {@link ManagedScheduledExecutorService}.
 * 
 * @param task the task to have the given ManagedTaskListener associated with
 * @param taskListener (optional) the {@code ManagedTaskListener} to receive  
 * lifecycle events notification when the task is submitted. If {@code task} 
 * implements {@code ManagedTask}, and {@code taskListener} is not 
 * {@code null}, the {@code ManagedTaskListener} interface methods of the 
 * task will not be called.
 * @return a Callable object
 * @throws IllegalArgumentException if {@code task} is {@code null}
 */
public static <V> Callable<V> managedTask(Callable<V> task, ManagedTaskListener taskListener) 
  throws IllegalArgumentException {
  return managedTask(task, null, taskListener);
}

origin: javax.enterprise.concurrent/javax.enterprise.concurrent-api

/**
 * Returns a {@link Callable} object that also implements {@link ManagedTask}
 * interface so it can receive notification of lifecycle events with the
 * provided {@link ManagedTaskListener} when the task is submitted 
 * to a {@link ManagedExecutorService} or a {@link ManagedScheduledExecutorService}.
 * 
 * @param task the task to have the given ManagedTaskListener associated with
 * @param taskListener (optional) the {@code ManagedTaskListener} to receive  
 * lifecycle events notification when the task is submitted. If {@code task} 
 * implements {@code ManagedTask}, and {@code taskListener} is not 
 * {@code null}, the {@code ManagedTaskListener} interface methods of the 
 * task will not be called.
 * @return a Callable object
 * @throws IllegalArgumentException if {@code task} is {@code null}
 */
public static <V> Callable<V> managedTask(Callable<V> task, ManagedTaskListener taskListener) 
  throws IllegalArgumentException {
  return managedTask(task, null, taskListener);
}

origin: jakarta.enterprise.concurrent/jakarta.enterprise.concurrent-api

/**
 * Returns a {@link Runnable} object that also implements {@link ManagedTask}
 * interface so it can receive notification of lifecycle events with the
 * provided {@link ManagedTaskListener} when the task is submitted 
 * to a {@link ManagedExecutorService} or a {@link ManagedScheduledExecutorService}.
 * <p>
 * Example:
 * <pre>
 * Runnable task = ...;
 * ManagedTaskListener myTaskListener = ...;
 * ManagedExecutorService executor = ...;
 * 
 * Runnable taskWithListener = ManagedExecutors.managedTask(task, myTaskListener);
 * executor.submit(taskWithListener);
 * </pre>
 * @param task the task to have the given ManagedTaskListener associated with
 * @param taskListener (optional) the {@code ManagedTaskListener} to receive  
 * lifecycle events notification when the task is submitted. If {@code task} 
 * implements {@code ManagedTask}, and {@code taskListener} is not 
 * {@code null}, the {@code ManagedTaskListener} interface methods of the 
 * task will not be called.
 * @return a Runnable object
 * @throws IllegalArgumentException if {@code task} is {@code null}
 */
public static Runnable managedTask(Runnable task, ManagedTaskListener taskListener)
  throws IllegalArgumentException {
  return managedTask(task, null, taskListener);
}

origin: javax.enterprise.concurrent/javax.enterprise.concurrent-api

/**
 * Returns a {@link Runnable} object that also implements {@link ManagedTask}
 * interface so it can receive notification of lifecycle events with the
 * provided {@link ManagedTaskListener} when the task is submitted 
 * to a {@link ManagedExecutorService} or a {@link ManagedScheduledExecutorService}.
 * <p>
 * Example:
 * <pre>
 * Runnable task = ...;
 * ManagedTaskListener myTaskListener = ...;
 * ManagedExecutorService executor = ...;
 * 
 * Runnable taskWithListener = ManagedExecutors.managedTask(task, myTaskListener);
 * executor.submit(taskWithListener);
 * </pre>
 * @param task the task to have the given ManagedTaskListener associated with
 * @param taskListener (optional) the {@code ManagedTaskListener} to receive  
 * lifecycle events notification when the task is submitted. If {@code task} 
 * implements {@code ManagedTask}, and {@code taskListener} is not 
 * {@code null}, the {@code ManagedTaskListener} interface methods of the 
 * task will not be called.
 * @return a Runnable object
 * @throws IllegalArgumentException if {@code task} is {@code null}
 */
public static Runnable managedTask(Runnable task, ManagedTaskListener taskListener)
  throws IllegalArgumentException {
  return managedTask(task, null, taskListener);
}

origin: apache/servicemix-bundles

  public static <T> Callable<T> buildManagedTask(Callable<T> task, String identityName) {
    Map<String, String> properties = new HashMap<>(2);
    properties.put(ManagedTask.IDENTITY_NAME, identityName);
    return ManagedExecutors.managedTask(task, properties, null);
  }
}
origin: audit4j/audit4j-core

  /**
   * Builds the managed task.
   *
   * @param <T> the generic type
   * @param task the task
   * @param identityName the identity name
   * @return the callable
   */
  public static <T> Callable<T> buildManagedTask(Callable<T> task, String identityName) {
    Map<String, String> properties = new HashMap<String, String>(1);
    properties.put(ManagedTask.IDENTITY_NAME, identityName);
    return ManagedExecutors.managedTask(task, properties, null);
  }
}
origin: audit4j/audit4j-core

/**
 * Builds the managed task.
 *
 * @param task the task
 * @param identityName the identity name
 * @return the runnable
 */
public static Runnable buildManagedTask(Runnable task, String identityName) {
  Map<String, String> properties = new HashMap<String, String>(2);
  if (task instanceof SchedulingAwareRunnable) {
    properties.put(ManagedTask.LONGRUNNING_HINT,
        Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
  }
  properties.put(ManagedTask.IDENTITY_NAME, identityName);
  return ManagedExecutors.managedTask(task, properties, null);
}
origin: apache/servicemix-bundles

/**
 * Delegate that wraps a given Runnable/Callable  with a JSR-236 ManagedTask,
 * exposing a long-running hint based on {@link SchedulingAwareRunnable}
 * and a given identity name.
 */
protected static class ManagedTaskBuilder {
  public static Runnable buildManagedTask(Runnable task, String identityName) {
    Map<String, String> properties;
    if (task instanceof SchedulingAwareRunnable) {
      properties = new HashMap<>(4);
      properties.put(ManagedTask.LONGRUNNING_HINT,
          Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
    }
    else {
      properties = new HashMap<>(2);
    }
    properties.put(ManagedTask.IDENTITY_NAME, identityName);
    return ManagedExecutors.managedTask(task, properties, null);
  }
  public static <T> Callable<T> buildManagedTask(Callable<T> task, String identityName) {
    Map<String, String> properties = new HashMap<>(2);
    properties.put(ManagedTask.IDENTITY_NAME, identityName);
    return ManagedExecutors.managedTask(task, properties, null);
  }
}
javax.enterprise.concurrentManagedExecutors

Most used methods

  • managedTask
    Returns a Callable object that also implements ManagedTaskinterface so it can receive notification o

Popular in Java

  • Making http requests using okhttp
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now