com.sun.jmx.snmp.tasks.Task Java Examples

The following examples show how to use com.sun.jmx.snmp.tasks.Task. 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: ThreadService.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #2
Source File: ThreadService.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: ThreadService.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #4
Source File: ThreadService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: ThreadService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #6
Source File: ThreadService.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #7
Source File: ThreadService.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #8
Source File: ThreadService.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #9
Source File: ThreadService.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #10
Source File: ThreadService.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #11
Source File: ThreadService.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #12
Source File: ThreadService.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #13
Source File: ThreadService.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #14
Source File: ThreadService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #15
Source File: ThreadService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #16
Source File: ThreadService.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #17
Source File: ThreadService.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #18
Source File: DelegatorTest.java    From event4j with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #19
Source File: ThreadService.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #20
Source File: ThreadService.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #21
Source File: ThreadService.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #22
Source File: ThreadService.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #23
Source File: ThreadService.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: ThreadService.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #25
Source File: ThreadService.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #26
Source File: ThreadService.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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;
}
 
Example #27
Source File: ThreadService.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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();
    }
}
 
Example #28
Source File: ThreadService.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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();
    }
}
 
Example #29
Source File: ThreadService.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #30
Source File: ThreadService.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}