Split out TransactionContext classes
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / OperationCompleter.java
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OperationCompleter.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/OperationCompleter.java
new file mode 100644 (file)
index 0000000..09fa61b
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.dispatch.OnComplete;
+import com.google.common.base.Preconditions;
+import java.util.concurrent.Semaphore;
+
+final class OperationCompleter extends OnComplete<Object> {
+    private final Semaphore operationLimiter;
+
+    OperationCompleter(Semaphore operationLimiter){
+        this.operationLimiter = Preconditions.checkNotNull(operationLimiter);
+    }
+
+    @Override
+    public void onComplete(Throwable throwable, Object o){
+        this.operationLimiter.release();
+    }
+}
\ No newline at end of file