本文整理汇总了Java中javax.enterprise.concurrent.ManagedTask类的典型用法代码示例。如果您正苦于以下问题:Java ManagedTask类的具体用法?Java ManagedTask怎么用?Java ManagedTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ManagedTask类属于javax.enterprise.concurrent包,在下文中一共展示了ManagedTask类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildManagedTask
import javax.enterprise.concurrent.ManagedTask; //导入依赖的package包/类
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);
}
示例2: buildManagedTask
import javax.enterprise.concurrent.ManagedTask; //导入依赖的package包/类
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);
}
示例3: buildManagedTask
import javax.enterprise.concurrent.ManagedTask; //导入依赖的package包/类
/**
* 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);
}
示例4: ManagedTaskListenerTask
import javax.enterprise.concurrent.ManagedTask; //导入依赖的package包/类
protected ManagedTaskListenerTask(final Object task) {
if (ManagedTask.class.isInstance(task)) {
listener = ManagedTask.class.cast(task).getManagedTaskListener();
} else {
listener = NoopManagedTaskListener.INSTANCE;
}
this.delegate = task;
}
示例5: start
import javax.enterprise.concurrent.ManagedTask; //导入依赖的package包/类
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());
}
}
示例6: CUHandler
import javax.enterprise.concurrent.ManagedTask; //导入依赖的package包/类
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));
}
示例7: getTaskId
import javax.enterprise.concurrent.ManagedTask; //导入依赖的package包/类
private static String getTaskId(final Object runnable) {
if (ManagedTask.class.isInstance(runnable)) {
return ManagedTask.class.cast(runnable).getExecutionProperties().get(ManagedTask.IDENTITY_NAME);
}
return null;
}