javax.enterprise.concurrent.ManagedTask Java Examples
The following examples show how to use
javax.enterprise.concurrent.ManagedTask.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConcurrentTaskExecutor.java From spring-analysis-note with MIT License | 5 votes |
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); }
Example #2
Source File: ConcurrentTaskExecutor.java From java-technology-stack with MIT License | 5 votes |
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); }
Example #3
Source File: ConcurrentTaskExecutor.java From lams with GNU General Public License v2.0 | 5 votes |
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); }
Example #4
Source File: ConcurrentTaskExecutor.java From spring4-understanding with Apache License 2.0 | 5 votes |
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); }
Example #5
Source File: ConcurrentTaskExecutor.java From audit4j-core with Apache License 2.0 | 5 votes |
/** * 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); }
Example #6
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 5 votes |
protected ManagedTaskListenerTask(final Object task) { if (ManagedTask.class.isInstance(task)) { listener = ManagedTask.class.cast(task).getManagedTaskListener(); } else { listener = NoopManagedTaskListener.INSTANCE; } this.delegate = task; }
Example #7
Source File: TransactionPropagationTest.java From tomee with Apache License 2.0 | 5 votes |
public void start() { cs.createContextualProxy(new IWantMyOwnTransaction(), Collections.singletonMap(ManagedTask.TRANSACTION, ManagedTask.SUSPEND), Runnable.class).run(); try { cs.createContextualProxy(new IWantMyTheCallerTransaction(txMgr.getTransaction()), Collections.singletonMap(ManagedTask.TRANSACTION, ManagedTask.USE_TRANSACTION_OF_EXECUTION_THREAD), Runnable.class).run(); } catch (final SystemException e) { fail(e.getMessage()); } }
Example #8
Source File: ConcurrentTaskExecutor.java From spring-analysis-note with MIT License | 4 votes |
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); }
Example #9
Source File: ConcurrentTaskExecutor.java From java-technology-stack with MIT License | 4 votes |
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); }
Example #10
Source File: ConcurrentTaskExecutor.java From lams with GNU General Public License v2.0 | 4 votes |
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); }
Example #11
Source File: ConcurrentTaskExecutor.java From spring4-understanding with Apache License 2.0 | 4 votes |
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); }
Example #12
Source File: ContextServiceImpl.java From tomee with Apache License 2.0 | 4 votes |
private CUHandler(final Object instance, final Map<String, String> props) { super(instance); this.instance = instance; this.properties = props; this.suspendTx = ManagedTask.SUSPEND.equals(props.get(ManagedTask.TRANSACTION)); }
Example #13
Source File: ManagedScheduledExecutorServiceImpl.java From tomee with Apache License 2.0 | 4 votes |
private static String getTaskId(final Object runnable) { if (ManagedTask.class.isInstance(runnable)) { return ManagedTask.class.cast(runnable).getExecutionProperties().get(ManagedTask.IDENTITY_NAME); } return null; }
Example #14
Source File: ConcurrentTaskExecutor.java From audit4j-core with Apache License 2.0 | 2 votes |
/** * 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); }