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


Java Task类代码示例

本文整理汇总了Java中com.sun.jmx.snmp.tasks.Task的典型用法代码示例。如果您正苦于以下问题:Java Task类的具体用法?Java Task怎么用?Java Task使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Task类属于com.sun.jmx.snmp.tasks包,在下文中一共展示了Task类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeTask

import com.sun.jmx.snmp.tasks.Task; //导入依赖的package包/类
public Runnable removeTask(Runnable task) {
    stateCheck();

    Runnable removed = null;
    synchronized(jobList) {
        int lg = jobList.indexOf(task);
        if (lg >= 0) {
            removed = jobList.remove(lg);
        }
    }
    if (removed != null && removed instanceof Task)
        ((Task) removed).cancel();
    return removed;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:ThreadService.java

示例2: removeAll

import com.sun.jmx.snmp.tasks.Task; //导入依赖的package包/类
public void removeAll() {
    stateCheck();

    final Object[] jobs;
    synchronized(jobList) {
        jobs = jobList.toArray();
        jobList.clear();
    }
    final int len = jobs.length;
    for (int i=0; i<len ; i++) {
        final Object o = jobs[i];
        if (o!= null && o instanceof Task) ((Task)o).cancel();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:ThreadService.java

示例3: createThreadPoolMock

import com.sun.jmx.snmp.tasks.Task; //导入依赖的package包/类
private ThreadPool createThreadPoolMock(String threadPoolName, int callTimes) {
    ThreadPool mock = createMock(ThreadPool.class);
    mock.submit( anyObject(Task.class), eq(threadPoolName));
    expectLastCall().andReturn(createMock(Future.class)).times(callTimes);
    replay(mock);
    
    return mock;
}
 
开发者ID:aofeng,项目名称:event4j,代码行数:9,代码来源:DelegatorTest.java

示例4: submitTask

import com.sun.jmx.snmp.tasks.Task; //导入依赖的package包/类
/**
 * Submit a task to be executed.
 * Once a task is submitted, it is guaranteed that either
 * {@link com.sun.jmx.snmp.tasks.Task#run() task.run()} or
 * {@link com.sun.jmx.snmp.tasks.Task#cancel() task.cancel()} will be called.
 * This implementation of TaskServer uses a thread pool to execute
 * the submitted tasks.
 * @param task The task to be executed.
 * @exception IllegalArgumentException if the submitted task is null.
 **/
public void submitTask(Task task) throws IllegalArgumentException {
    submitTask((Runnable)task);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:ThreadService.java


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