use of org.opennms.core.tasks.Task in project opennms by OpenNMS.
the class NodeScan method schedule.
ScheduledFuture<?> schedule(ScheduledExecutorService executor, NodeScanSchedule schedule) {
final Runnable r = new Runnable() {
@Override
public void run() {
try {
final Task t = createTask();
t.schedule();
// NMS-5593 shows 10 provisioning threads all waiting on these
// latches which is probably exhausting the thread pool
t.waitFor();
LOG.info("Finished scanning node {}/{}/{}", getNodeId(), getForeignSource(), getForeignId());
} catch (final InterruptedException e) {
LOG.warn("The node scan for node {}/{}/{} was interrupted", getNodeId(), getForeignSource(), getForeignId(), e);
Thread.currentThread().interrupt();
} catch (final ExecutionException e) {
LOG.warn("An error occurred while scanning node {}/{}/{}", getNodeId(), getForeignSource(), getForeignId(), e);
}
}
};
return executor.scheduleWithFixedDelay(r, schedule.getInitialDelay().getMillis(), schedule.getScanInterval().getMillis(), TimeUnit.MILLISECONDS);
}
use of org.opennms.core.tasks.Task in project opennms by OpenNMS.
the class DragonWaveNodeSwitchingIT method runScan.
public void runScan(final NodeScan scan) throws InterruptedException, ExecutionException {
final Task t = scan.createTask();
t.schedule();
t.waitFor();
waitForEverything();
}
use of org.opennms.core.tasks.Task in project opennms by OpenNMS.
the class IfIndexNullIT method runScan.
public void runScan(final NodeScan scan) throws InterruptedException, ExecutionException {
final Task t = scan.createTask();
t.schedule();
t.waitFor();
waitForEverything();
}
use of org.opennms.core.tasks.Task in project opennms by OpenNMS.
the class NewSuspectScanIT method runScan.
public void runScan(final Scan scan) throws InterruptedException, ExecutionException {
final Task t = scan.createTask();
t.schedule();
t.waitFor();
waitForEverything();
}
use of org.opennms.core.tasks.Task in project opennms by OpenNMS.
the class ProvisionerIT method runScan.
private void runScan(final Scan scan) throws InterruptedException, ExecutionException {
final boolean paused = getScheduledExecutor().isPaused();
if (paused)
getScheduledExecutor().resume();
final Task t = scan.createTask();
t.schedule();
t.waitFor();
waitForEverything();
if (paused)
getScheduledExecutor().pause();
}
Aggregations