Refactor TransactionProxy
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / TransactionContextImpl.java
index ce2c99ef52b2f6d76ee005accc60f4a9475e3253..530a36cff657304005ebd4b43a5bb1e46449951b 100644 (file)
@@ -12,7 +12,6 @@ import akka.dispatch.Mapper;
 import akka.dispatch.OnComplete;
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
 import akka.dispatch.OnComplete;
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.List;
 import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.List;
 import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier;
@@ -30,7 +29,6 @@ import org.opendaylight.controller.cluster.datastore.messages.VersionedSerializa
 import org.opendaylight.controller.cluster.datastore.messages.WriteData;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.cluster.datastore.messages.WriteData;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.yangtools.util.concurrent.MappingCheckedFuture;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -179,13 +177,11 @@ final class TransactionContextImpl extends AbstractTransactionContext {
     }
 
     @Override
     }
 
     @Override
-    public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> readData(
-            final YangInstanceIdentifier path) {
+    public void readData(
+            final YangInstanceIdentifier path,final SettableFuture<Optional<NormalizedNode<?, ?>>> returnFuture ) {
 
         LOG.debug("Tx {} readData called path = {}", identifier, path);
 
 
         LOG.debug("Tx {} readData called path = {}", identifier, path);
 
-        final SettableFuture<Optional<NormalizedNode<?, ?>>> returnFuture = SettableFuture.create();
-
         // If there were any previous recorded put/merge/delete operation reply Futures then we
         // must wait for them to successfully complete. This is necessary to honor the read
         // uncommitted semantics of the public API contract. If any one fails then fail the read.
         // If there were any previous recorded put/merge/delete operation reply Futures then we
         // must wait for them to successfully complete. This is necessary to honor the read
         // uncommitted semantics of the public API contract. If any one fails then fail the read.
@@ -223,7 +219,6 @@ final class TransactionContextImpl extends AbstractTransactionContext {
             combinedFutures.onComplete(onComplete, actorContext.getActorSystem().dispatcher());
         }
 
             combinedFutures.onComplete(onComplete, actorContext.getActorSystem().dispatcher());
         }
 
-        return MappingCheckedFuture.create(returnFuture, ReadFailedException.MAPPER);
     }
 
     private void finishReadData(final YangInstanceIdentifier path,
     }
 
     private void finishReadData(final YangInstanceIdentifier path,
@@ -264,13 +259,10 @@ final class TransactionContextImpl extends AbstractTransactionContext {
     }
 
     @Override
     }
 
     @Override
-    public CheckedFuture<Boolean, ReadFailedException> dataExists(
-            final YangInstanceIdentifier path) {
+    public void dataExists(final YangInstanceIdentifier path, final SettableFuture<Boolean> returnFuture) {
 
         LOG.debug("Tx {} dataExists called path = {}", identifier, path);
 
 
         LOG.debug("Tx {} dataExists called path = {}", identifier, path);
 
-        final SettableFuture<Boolean> returnFuture = SettableFuture.create();
-
         // If there were any previous recorded put/merge/delete operation reply Futures then we
         // must wait for them to successfully complete. This is necessary to honor the read
         // uncommitted semantics of the public API contract. If any one fails then fail this
         // If there were any previous recorded put/merge/delete operation reply Futures then we
         // must wait for them to successfully complete. This is necessary to honor the read
         // uncommitted semantics of the public API contract. If any one fails then fail this
@@ -307,8 +299,6 @@ final class TransactionContextImpl extends AbstractTransactionContext {
 
             combinedFutures.onComplete(onComplete, actorContext.getActorSystem().dispatcher());
         }
 
             combinedFutures.onComplete(onComplete, actorContext.getActorSystem().dispatcher());
         }
-
-        return MappingCheckedFuture.create(returnFuture, ReadFailedException.MAPPER);
     }
 
     private void finishDataExists(final YangInstanceIdentifier path,
     }
 
     private void finishDataExists(final YangInstanceIdentifier path,
@@ -344,4 +334,4 @@ final class TransactionContextImpl extends AbstractTransactionContext {
 
         future.onComplete(onComplete, actorContext.getActorSystem().dispatcher());
     }
 
         future.onComplete(onComplete, actorContext.getActorSystem().dispatcher());
     }
-}
\ No newline at end of file
+}