use of org.opendaylight.netvirt.elan.l2gw.jobs.DeleteLogicalSwitchJob in project netvirt by opendaylight.
the class ElanL2GatewayUtils method scheduleDeleteLogicalSwitch.
public void scheduleDeleteLogicalSwitch(final NodeId hwvtepNodeId, final String lsName, final boolean clearUcast) {
final Pair<NodeId, String> nodeIdLogicalSwitchNamePair = new ImmutablePair<>(hwvtepNodeId, lsName);
logicalSwitchDeletedTasks.computeIfAbsent(nodeIdLogicalSwitchNamePair, (key) -> {
return scheduler.getScheduledExecutorService().schedule(() -> {
DeleteLogicalSwitchJob deleteLsJob = new DeleteLogicalSwitchJob(broker, ElanL2GatewayUtils.this, hwvtepNodeId, lsName, clearUcast);
jobCoordinator.enqueueJob(deleteLsJob.getJobKey(), deleteLsJob, SystemPropertyReader.getDataStoreJobCoordinatorMaxRetries());
deleteJobs.put(nodeIdLogicalSwitchNamePair, deleteLsJob);
logicalSwitchDeletedTasks.remove(nodeIdLogicalSwitchNamePair);
}, getLogicalSwitchDeleteDelaySecs(), TimeUnit.SECONDS);
});
}
use of org.opendaylight.netvirt.elan.l2gw.jobs.DeleteLogicalSwitchJob in project netvirt by opendaylight.
the class ElanL2GatewayUtils method cancelDeleteLogicalSwitch.
public void cancelDeleteLogicalSwitch(final NodeId hwvtepNodeId, final String lsName) {
Pair<NodeId, String> nodeIdLogicalSwitchNamePair = new ImmutablePair<>(hwvtepNodeId, lsName);
ScheduledFuture logicalSwitchDeleteTask = logicalSwitchDeletedTasks.remove(nodeIdLogicalSwitchNamePair);
if (logicalSwitchDeleteTask != null) {
LOG.debug("Delete logical switch {} action on node {} cancelled", lsName, hwvtepNodeId);
logicalSwitchDeleteTask.cancel(true);
DeleteLogicalSwitchJob deleteLogicalSwitchJob = deleteJobs.remove(nodeIdLogicalSwitchNamePair);
if (deleteLogicalSwitchJob != null) {
deleteLogicalSwitchJob.cancel();
}
}
}
Aggregations