Define efficient serialization proxies
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DebugThreePhaseCommitCohort.java
index a2a2bfca0850e746e045f561d1db0d6f5635732c..4562ed13c56955c96e3f5ede6cb97c3231e5fb30 100644 (file)
@@ -7,14 +7,18 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.List;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
+import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.yangtools.yang.common.Empty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import scala.concurrent.Future;
@@ -31,13 +35,15 @@ class DebugThreePhaseCommitCohort extends AbstractThreePhaseCommitCohort<Object>
     private final AbstractThreePhaseCommitCohort<?> delegate;
     private final Throwable debugContext;
     private final TransactionIdentifier transactionId;
+
+    @SuppressFBWarnings("SLF4J_LOGGER_SHOULD_BE_FINAL")
     private Logger log = LOG;
 
     DebugThreePhaseCommitCohort(final TransactionIdentifier transactionId,
             final AbstractThreePhaseCommitCohort<?> delegate, final Throwable debugContext) {
-        this.delegate = Preconditions.checkNotNull(delegate);
-        this.debugContext = Preconditions.checkNotNull(debugContext);
-        this.transactionId = Preconditions.checkNotNull(transactionId);
+        this.delegate = requireNonNull(delegate);
+        this.debugContext = requireNonNull(debugContext);
+        this.transactionId = requireNonNull(transactionId);
     }
 
     private <V> ListenableFuture<V> addFutureCallback(final ListenableFuture<V> future) {
@@ -63,17 +69,17 @@ class DebugThreePhaseCommitCohort extends AbstractThreePhaseCommitCohort<Object>
     }
 
     @Override
-    public ListenableFuture<Void> preCommit() {
+    public ListenableFuture<Empty> preCommit() {
         return addFutureCallback(delegate.preCommit());
     }
 
     @Override
-    public ListenableFuture<Void> commit() {
+    public ListenableFuture<? extends CommitInfo> commit() {
         return addFutureCallback(delegate.commit());
     }
 
     @Override
-    public ListenableFuture<Void> abort() {
+    public ListenableFuture<Empty> abort() {
         return delegate.abort();
     }
 
@@ -84,7 +90,7 @@ class DebugThreePhaseCommitCohort extends AbstractThreePhaseCommitCohort<Object>
     }
 
     @VisibleForTesting
-    void setLogger(final Logger log) {
-        this.log = log;
+    void setLogger(final Logger logger) {
+        log = logger;
     }
 }