import org.opendaylight.openflowplugin.applications.frsync.SemaphoreKeeper;
import org.opendaylight.openflowplugin.applications.frsync.SyncReactor;
import org.opendaylight.openflowplugin.applications.frsync.util.PathUtil;
+import org.opendaylight.openflowplugin.applications.frsync.util.SemaphoreKeeperGuavaImpl;
import org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
private static final Logger LOG = LoggerFactory.getLogger(SyncReactorGuardDecorator.class);
private final SyncReactor delegate;
- private final SemaphoreKeeper<InstanceIdentifier<FlowCapableNode>> semaphoreKeeper;
+ private final SemaphoreKeeper<InstanceIdentifier<FlowCapableNode>> semaphoreKeeper =
+ new SemaphoreKeeperGuavaImpl<>(1, true);
- public SyncReactorGuardDecorator(final SyncReactor delegate,
- final SemaphoreKeeper<InstanceIdentifier<FlowCapableNode>> semaphoreKeeper) {
+ public SyncReactorGuardDecorator(final SyncReactor delegate) {
this.delegate = delegate;
- this.semaphoreKeeper = semaphoreKeeper;
}
public ListenableFuture<Boolean> syncup(final InstanceIdentifier<FlowCapableNode> flowcapableNodePath,
}
private FutureCallback<Boolean> createSyncupCallback(final Semaphore guard,
- final long stampBeforeGuard,
- final long stampAfterGuard,
- final NodeId nodeId) {
+ final long stampBeforeGuard,
+ final long stampAfterGuard,
+ final NodeId nodeId) {
return new FutureCallback<Boolean>() {
@Override
public void onSuccess(@Nullable final Boolean result) {