当前位置: 首页>>代码示例>>Java>>正文


Java ManagedTask类代码示例

本文整理汇总了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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ConcurrentTaskExecutor.java

示例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);
}
 
开发者ID:janithb,项目名称:Clockwise,代码行数:10,代码来源:ConcurrentTaskExecutor.java

示例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);
}
 
开发者ID:audit4j,项目名称:audit4j-core,代码行数:17,代码来源:ConcurrentTaskExecutor.java

示例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;
}
 
开发者ID:apache,项目名称:tomee,代码行数:9,代码来源:ManagedTaskListenerTask.java

示例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());
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:9,代码来源:TransactionPropagationTest.java

示例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));
}
 
开发者ID:apache,项目名称:tomee,代码行数:7,代码来源:ContextServiceImpl.java

示例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;
}
 
开发者ID:apache,项目名称:tomee,代码行数:7,代码来源:ManagedScheduledExecutorServiceImpl.java


注:本文中的javax.enterprise.concurrent.ManagedTask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。