Migrate nullness annotations 18/81318/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 29 Mar 2019 01:53:09 +0000 (02:53 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 30 Mar 2019 18:53:18 +0000 (19:53 +0100)
This mass-migrates sal-distributed-datastore to use JDT nullness
annotations instead of JSR305.

Change-Id: I2cd739e3db8c074a55e335e17297a23065775d6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
88 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedReadTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedReadWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ClientBackedWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractClientHandle.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractProxyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractShardBackendResolver.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/ClientTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/DataStoreClient.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/DistributedDataStoreClientActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalProxyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalReadWriteProxyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/RemoteProxyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/SimpleDataStoreClientActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionContextFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CompositeDataTreeCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendClientMetadataBuilder.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendHistoryMetadataBuilder.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendMetadata.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendReadOnlyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendReadWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/FrontendTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LeaderFrontendState.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionFactoryImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalTransactionReadySupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeMetadata.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionMessageRetrySupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/StandaloneFrontendHistory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/compat/LegacyDOMStoreAdapter.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/Configuration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ConfigurationImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ModuleConfig.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ModuleShardConfigProvider.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ModuleShardConfiguration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ShardConfig.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipShardCommitCoordinator.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipStatistics.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/EntityOwnerSelectionStrategy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/selectionstrategy/LeastLoadedCandidateSelectionStrategy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/NoShardLeaderException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardMBeanFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AddPrefixShardReplica.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AddShardReplica.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/BatchedModifications.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateShard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ForwardedReadyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/LocalPrimaryShardFound.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyLocalTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RemoteFindPrimary.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RemovePrefixShardReplica.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RemoveShardReplica.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractIdentifiablePayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractVersionException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractVersionedShardDataTreeSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/DatastoreSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/PayloadVersion.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshotMetadata.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardManagerSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardSnapshotState.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardInformation.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerSnapshot.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/SwitchShardBehavior.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/PrimaryShardInfoFutureCache.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DOMDataTreeShardCreationFailedException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardChangePublisher.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontend.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/LookupTask.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/PrefixedShardConfigUpdateHandler.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/ShardProxyProducer.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/ShardProxyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/actors/dds/TransactionTester.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockDataTreeChangeListener.java

index de4ae32..30a51de 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.cluster.databroker;
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Optional;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientSnapshot;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -31,8 +31,8 @@ final class ClientBackedReadTransaction extends ClientBackedTransaction<ClientSn
     @SuppressWarnings("unused")
     private volatile ClientBackedTransactionChain parent;
 
-    ClientBackedReadTransaction(final ClientSnapshot delegate, @Nullable final ClientBackedTransactionChain parent,
-        @Nullable final Throwable allocationContext) {
+    ClientBackedReadTransaction(final ClientSnapshot delegate, final @Nullable ClientBackedTransactionChain parent,
+            final @Nullable Throwable allocationContext) {
         super(delegate, allocationContext);
         this.parent = parent;
     }
index cfc251d..6931d9a 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.databroker;
 
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Optional;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 final class ClientBackedReadWriteTransaction extends ClientBackedWriteTransaction
         implements DOMStoreReadWriteTransaction {
 
-    ClientBackedReadWriteTransaction(final ClientTransaction delegate, @Nullable final Throwable allocationContext) {
+    ClientBackedReadWriteTransaction(final ClientTransaction delegate, final @Nullable Throwable allocationContext) {
         super(delegate, allocationContext);
     }
 
index 4d979cd..55b787a 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.databroker;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.FinalizablePhantomReference;
 import com.google.common.base.FinalizableReferenceQueue;
-import com.google.common.base.Preconditions;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.databroker.actors.dds.AbstractClientHandle;
 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction;
@@ -41,14 +42,13 @@ abstract class ClientBackedTransaction<T extends AbstractClientHandle<?>> extend
         private Finalizer(final ClientBackedTransaction<?> referent, final AbstractClientHandle<?> transaction,
                 final Throwable allocationContext) {
             super(referent, QUEUE);
-            this.transaction = Preconditions.checkNotNull(transaction);
+            this.transaction = requireNonNull(transaction);
             this.allocationContext = allocationContext;
         }
 
-        @Nonnull
-        static <T extends AbstractClientHandle<?>> T recordTransaction(
-                @Nonnull final ClientBackedTransaction<T> referent, @Nonnull final T transaction,
-                @Nullable final Throwable allocationContext) {
+        static <T extends AbstractClientHandle<?>> @NonNull T recordTransaction(
+                final @NonNull ClientBackedTransaction<T> referent, final @NonNull T transaction,
+                final @Nullable Throwable allocationContext) {
             FINALIZERS.add(new Finalizer(referent, transaction, allocationContext));
             return transaction;
         }
index 737e70d..8a8623e 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.databroker;
 
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
@@ -21,7 +21,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  */
 class ClientBackedWriteTransaction extends ClientBackedTransaction<ClientTransaction>
         implements DOMStoreWriteTransaction {
-    ClientBackedWriteTransaction(final ClientTransaction delegate, @Nullable final Throwable allocationContext) {
+    ClientBackedWriteTransaction(final ClientTransaction delegate, final @Nullable Throwable allocationContext) {
         super(delegate, allocationContext);
     }
 
index 4b1d613..80fbf03 100644 (file)
@@ -15,7 +15,7 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 import java.util.function.Function;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -95,7 +95,7 @@ public abstract class AbstractClientHandle<T extends AbstractProxyTransaction> e
      * @return null if this snapshot has already been closed, otherwise a collection of proxies, which need to be
      *         closed, too.
      */
-    @Nullable final Collection<T> ensureClosed() {
+    final @Nullable Collection<T> ensureClosed() {
         @SuppressWarnings("unchecked")
         final State<T> local = STATE_UPDATER.getAndSet(this, null);
         return local == null ? null : local.values();
index 12858b9..e5d8abc 100644 (file)
@@ -13,7 +13,7 @@ import static java.util.Objects.requireNonNull;
 import akka.actor.ActorRef;
 import akka.util.Timeout;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.client.AbstractClientActor;
 import org.opendaylight.controller.cluster.access.client.ClientActorConfig;
 import org.opendaylight.controller.cluster.access.client.ClientActorContext;
@@ -48,7 +48,7 @@ public abstract class AbstractDataStoreClientActor extends AbstractClientActor {
     abstract AbstractDataStoreClientBehavior initialBehavior(ClientActorContext context, ActorUtils actorUtils);
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public static DataStoreClient getDistributedDataStoreClient(@Nonnull final ActorRef actor,
+    public static DataStoreClient getDistributedDataStoreClient(final @NonNull ActorRef actor,
             final long timeout, final TimeUnit unit) {
         try {
             return (DataStoreClient) Await.result(ExplicitAsk.ask(actor, GET_CLIENT_FACTORY,
index 546738f..e1919d1 100644 (file)
@@ -23,10 +23,10 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 import java.util.function.Consumer;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.client.ConnectionEntry;
 import org.opendaylight.controller.cluster.access.commands.AbstractLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.ClosedTransactionException;
@@ -419,7 +419,7 @@ abstract class AbstractProxyTransaction implements Identifiable<TransactionIdent
         }
     }
 
-    final void recordSuccessfulRequest(@Nonnull final TransactionRequest<?> req) {
+    final void recordSuccessfulRequest(final @NonNull TransactionRequest<?> req) {
         successfulRequests.add(Verify.verifyNotNull(req));
     }
 
index eddbba6..e32d1bf 100644 (file)
@@ -21,10 +21,10 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.Consumer;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.ThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.controller.cluster.access.client.BackendInfoResolver;
 import org.opendaylight.controller.cluster.access.commands.ConnectClientRequest;
@@ -63,11 +63,11 @@ abstract class AbstractShardBackendResolver extends BackendInfoResolver<ShardBac
             stage.whenComplete(this::onStageResolved);
         }
 
-        @Nonnull CompletionStage<ShardBackendInfo> getStage() {
+        @NonNull CompletionStage<ShardBackendInfo> getStage() {
             return stage;
         }
 
-        @Nullable synchronized ShardBackendInfo getResult() {
+        synchronized @Nullable ShardBackendInfo getResult() {
             return result;
         }
 
index 9c09838..46e208b 100644 (file)
@@ -13,7 +13,7 @@ import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Collection;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCursor;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
@@ -116,7 +116,7 @@ public class ClientTransaction extends AbstractClientHandle<AbstractProxyTransac
         return parent().onTransactionReady(this, cohort);
     }
 
-    void closeCursor(@Nonnull final DOMDataTreeCursor cursorToClose) {
+    void closeCursor(final @NonNull DOMDataTreeCursor cursorToClose) {
         if (cursorToClose.equals(this.cursor)) {
             this.cursor = null;
         }
index 2032b54..e3dc91c 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.yangtools.concepts.Identifiable;
 
@@ -22,10 +22,8 @@ import org.opendaylight.yangtools.concepts.Identifiable;
  * @author Robert Varga
  */
 @Beta
+@NonNullByDefault
 public interface DataStoreClient extends Identifiable<ClientIdentifier>, AutoCloseable {
-    @Override
-    @Nonnull ClientIdentifier getIdentifier();
-
     @Override
     void close();
 
@@ -34,19 +32,19 @@ public interface DataStoreClient extends Identifiable<ClientIdentifier>, AutoClo
      *
      * @return Client history handle
      */
-    @Nonnull ClientLocalHistory createLocalHistory();
+    ClientLocalHistory createLocalHistory();
 
     /**
      * Create a new free-standing snapshot.
      *
      * @return Client snapshot handle
      */
-    @Nonnull ClientSnapshot createSnapshot();
+    ClientSnapshot createSnapshot();
 
     /**
      * Create a new free-standing transaction.
      *
      * @return Client transaction handle
      */
-    @Nonnull ClientTransaction createTransaction();
+    ClientTransaction createTransaction();
 }
index 719a3b1..1701d4c 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
 import akka.actor.Props;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.client.AbstractClientActor;
 import org.opendaylight.controller.cluster.access.client.ClientActorContext;
 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
@@ -31,8 +31,8 @@ public final class DistributedDataStoreClientActor extends AbstractDataStoreClie
         return new DistributedDataStoreClientBehavior(context, actorUtils);
     }
 
-    public static Props props(@Nonnull final MemberName memberName, @Nonnull final String storeName,
-            final ActorUtils ctx) {
+    public static Props props(final @NonNull MemberName memberName, final @NonNull String storeName,
+            final @NonNull ActorUtils ctx) {
         final String name = "datastore-" + storeName;
         final FrontendIdentifier frontendId = FrontendIdentifier.create(memberName, FrontendType.forName(name));
         return Props.create(DistributedDataStoreClientActor.class,
index 2a81e1d..6679725 100644 (file)
@@ -7,13 +7,15 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Optional;
 import java.util.function.Consumer;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.AbstractLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest;
@@ -60,7 +62,7 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction {
 
     LocalProxyTransaction(final ProxyHistory parent, final TransactionIdentifier identifier, final boolean isDone) {
         super(parent, isDone);
-        this.identifier = Preconditions.checkNotNull(identifier);
+        this.identifier = requireNonNull(identifier);
     }
 
     @Override
@@ -68,8 +70,7 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction {
         return identifier;
     }
 
-    @Nonnull
-    abstract DataTreeSnapshot readOnlyView();
+    abstract @NonNull DataTreeSnapshot readOnlyView();
 
     abstract void applyForwardedModifyTransactionRequest(ModifyTransactionRequest request,
             @Nullable Consumer<Response<?, ?>> callback);
@@ -102,8 +103,7 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction {
         }
     }
 
-    private boolean handleReadRequest(final TransactionRequest<?> request,
-            @Nullable final Consumer<Response<?, ?>> callback) {
+    private boolean handleReadRequest(final TransactionRequest<?> request, final Consumer<Response<?, ?>> callback) {
         // Note we delay completion of read requests to limit the scope at which the client can run, as they have
         // listeners, which we do not want to execute while we are reconnecting.
         if (request instanceof ReadTransactionRequest) {
@@ -132,8 +132,8 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction {
     }
 
     @Override
-    void handleReplayedRemoteRequest(final TransactionRequest<?> request,
-            @Nullable final Consumer<Response<?, ?>> callback, final long enqueuedTicks) {
+    void handleReplayedRemoteRequest(final TransactionRequest<?> request, final Consumer<Response<?, ?>> callback,
+            final long enqueuedTicks) {
         if (request instanceof ModifyTransactionRequest) {
             replayModifyTransactionRequest((ModifyTransactionRequest) request, callback, enqueuedTicks);
         } else if (handleReadRequest(request, callback)) {
index cf2ea8a..4f0290e 100644 (file)
@@ -13,9 +13,9 @@ import java.util.Optional;
 import java.util.function.BiConsumer;
 import java.util.function.Consumer;
 import java.util.function.Supplier;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.AbstractLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest;
@@ -228,18 +228,18 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
 
     @Override
     void applyForwardedModifyTransactionRequest(final ModifyTransactionRequest request,
-            @Nullable final Consumer<Response<?, ?>> callback) {
+            final Consumer<Response<?, ?>> callback) {
         commonModifyTransactionRequest(request, callback, this::sendRequest);
     }
 
     @Override
     void replayModifyTransactionRequest(final ModifyTransactionRequest request,
-            @Nullable final Consumer<Response<?, ?>> callback, final long enqueuedTicks) {
+            final Consumer<Response<?, ?>> callback, final long enqueuedTicks) {
         commonModifyTransactionRequest(request, callback, (req, cb) -> enqueueRequest(req, cb, enqueuedTicks));
     }
 
     private void commonModifyTransactionRequest(final ModifyTransactionRequest request,
-            @Nullable final Consumer<Response<?, ?>> callback,
+            final @Nullable Consumer<Response<?, ?>> callback,
             final BiConsumer<TransactionRequest<?>, Consumer<Response<?, ?>>> sendMethod) {
         for (final TransactionModification mod : request.getModifications()) {
             if (mod instanceof TransactionWrite) {
@@ -291,7 +291,7 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
 
     @Override
     void handleReplayedRemoteRequest(final TransactionRequest<?> request,
-            @Nullable final Consumer<Response<?, ?>> callback, final long enqueuedTicks) {
+            final Consumer<Response<?, ?>> callback, final long enqueuedTicks) {
         LOG.debug("Applying replayed request {}", request);
 
         if (request instanceof TransactionPreCommitRequest) {
@@ -347,8 +347,7 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
         closedException = this::abortedException;
     }
 
-    @Nonnull
-    private CursorAwareDataTreeModification getModification() {
+    private @NonNull CursorAwareDataTreeModification getModification() {
         if (closedException != null) {
             throw closedException.get();
         }
index d36218c..8bdf359 100644 (file)
@@ -14,7 +14,6 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.Optional;
 import java.util.function.Consumer;
-import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.client.RequestTimeoutException;
 import org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.AbstractLocalTransactionRequest;
@@ -434,8 +433,8 @@ final class RemoteProxyTransaction extends AbstractProxyTransaction {
     }
 
     @Override
-    void handleReplayedRemoteRequest(final TransactionRequest<?> request,
-            @Nullable final Consumer<Response<?, ?>> callback, final long enqueuedTicks) {
+    void handleReplayedRemoteRequest(final TransactionRequest<?> request, final Consumer<Response<?, ?>> callback,
+            final long enqueuedTicks) {
         final Consumer<Response<?, ?>> cb = callback != null ? callback : resp -> { /* NOOP */ };
         final Optional<Long> optTicks = Optional.of(Long.valueOf(enqueuedTicks));
 
index de67400..b19de5a 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.cluster.databroker.actors.dds;
 import static java.util.Objects.requireNonNull;
 
 import akka.actor.Props;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.client.AbstractClientActor;
 import org.opendaylight.controller.cluster.access.client.ClientActorContext;
 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
@@ -37,7 +37,7 @@ public final class SimpleDataStoreClientActor extends AbstractDataStoreClientAct
         return new SimpleDataStoreClientBehavior(context, actorUtils, shardName);
     }
 
-    public static Props props(@Nonnull final MemberName memberName, @Nonnull final String storeName,
+    public static Props props(final @NonNull MemberName memberName, final @NonNull String storeName,
             final ActorUtils actorUtils, final String shardName) {
         final String name = "datastore-" + storeName;
         final FrontendIdentifier frontendId = FrontendIdentifier.create(memberName, FrontendType.forName(name));
index 072f8ed..e136d50 100644 (file)
@@ -17,7 +17,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 import java.util.SortedSet;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.commands.AbstractReadTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.ClosedTransactionException;
 import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest;
@@ -74,8 +74,7 @@ abstract class AbstractFrontendHistory implements Identifiable<LocalHistoryIdent
         return tree.readTime();
     }
 
-    @Nullable
-    final TransactionSuccess<?> handleTransactionRequest(final TransactionRequest<?> request,
+    final @Nullable TransactionSuccess<?> handleTransactionRequest(final TransactionRequest<?> request,
             final RequestEnvelope envelope, final long now) throws RequestException {
         if (request instanceof TransactionPurgeRequest) {
             return handleTransactionPurgeRequest(request, envelope, now);
index 6c4fc60..bc8efa6 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -24,6 +24,7 @@ abstract class AbstractTransactionContext implements TransactionContext {
     }
 
     protected AbstractTransactionContext(TransactionIdentifier transactionIdentifier, short transactionVersion) {
+        // FIXME: requireNonNull()?
         this.transactionIdentifier = transactionIdentifier;
         this.transactionVersion = transactionVersion;
     }
@@ -33,7 +34,8 @@ abstract class AbstractTransactionContext implements TransactionContext {
      *
      * @return Transaction identifier.
      */
-    @Nonnull protected final TransactionIdentifier getIdentifier() {
+    // FIXME: does this imply Identifiable?
+    protected final @NonNull TransactionIdentifier getIdentifier() {
         return transactionIdentifier;
     }
 
index a2bbc11..a415a8c 100644 (file)
@@ -16,7 +16,7 @@ import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
@@ -177,8 +177,8 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
      * @param shardName Shard name
      * @return Future containing shard information.
      */
-    protected abstract Future<PrimaryShardInfo> findPrimaryShard(@Nonnull String shardName,
-            @Nonnull TransactionIdentifier txId);
+    protected abstract Future<PrimaryShardInfo> findPrimaryShard(@NonNull String shardName,
+            @NonNull TransactionIdentifier txId);
 
     /**
      * Create local transaction factory for specified shard, backed by specified shard leader
@@ -197,15 +197,15 @@ abstract class AbstractTransactionContextFactory<F extends LocalTransactionFacto
      * be waited for before the next transaction is allocated.
      * @param cohortFutures Collection of futures
      */
-    protected abstract <T> void onTransactionReady(@Nonnull TransactionIdentifier transaction,
-            @Nonnull Collection<Future<T>> cohortFutures);
+    protected abstract <T> void onTransactionReady(@NonNull TransactionIdentifier transaction,
+            @NonNull Collection<Future<T>> cohortFutures);
 
     /**
      * Callback invoked when the internal TransactionContext has been created for a transaction.
      *
      * @param transactionId the ID of the transaction.
      */
-    protected abstract void onTransactionContextCreated(@Nonnull TransactionIdentifier transactionId);
+    protected abstract void onTransactionContextCreated(@NonNull TransactionIdentifier transactionId);
 
     private static TransactionContext createLocalTransactionContext(final LocalTransactionFactory factory,
                                                                     final TransactionProxy parent) {
index 200f766..5e1add1 100644 (file)
@@ -31,7 +31,7 @@ import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CompletionStage;
 import java.util.concurrent.Executor;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.CanCommit;
 import org.opendaylight.controller.cluster.datastore.DataTreeCohortActor.Success;
@@ -104,8 +104,7 @@ class CompositeDataTreeCohort {
     private final Executor callbackExecutor;
     private final Timeout timeout;
 
-    @Nonnull
-    private List<Success> successfulFromPrevious = Collections.emptyList();
+    private @NonNull List<Success> successfulFromPrevious = Collections.emptyList();
     private State state = State.IDLE;
 
     CompositeDataTreeCohort(final DataTreeCohortActorRegistry registry, final TransactionIdentifier transactionID,
@@ -222,8 +221,7 @@ class CompositeDataTreeCohort {
         return ret;
     }
 
-    @Nonnull
-    private CompletionStage<Void> processResponses(final List<Entry<ActorRef, Future<Object>>> futures,
+    private @NonNull CompletionStage<Void> processResponses(final List<Entry<ActorRef, Future<Object>>> futures,
             final State currentState, final State afterState) {
         LOG.debug("{}: processResponses - currentState: {}, afterState: {}", txId, currentState, afterState);
         final CompletableFuture<Void> returnFuture = new CompletableFuture<>();
index 26c5f45..c8372e4 100644 (file)
@@ -5,7 +5,6 @@
  * 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.actor.ActorRef;
@@ -20,8 +19,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.Executor;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
 import org.opendaylight.mdsal.common.api.PostCanCommitStep;
@@ -235,11 +234,9 @@ final class DataTreeCohortActor extends AbstractUntypedActor {
             }, MoreExecutors.directExecutor());
         }
 
-        @Nullable
-        abstract CohortBehaviour<?, ?> nextBehaviour(TransactionIdentifier txId, S nextStep);
+        abstract @Nullable CohortBehaviour<?, ?> nextBehaviour(TransactionIdentifier txId, S nextStep);
 
-        @Nonnull
-        abstract ListenableFuture<S> process(M command);
+        abstract @NonNull ListenableFuture<S> process(M command);
 
         abstract ListenableFuture<?> abort();
 
index 6270b38..763b2e9 100644 (file)
@@ -14,8 +14,8 @@ import com.google.common.base.MoreObjects;
 import com.google.common.collect.Collections2;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
@@ -154,7 +154,7 @@ final class FrontendClientMetadataBuilder implements Builder<FrontendClientMetad
      * @param shard parent shard
      * @return Leader frontend state
      */
-    @Nonnull LeaderFrontendState toLeaderState(@Nonnull final Shard shard) {
+    @NonNull LeaderFrontendState toLeaderState(final @NonNull Shard shard) {
         // Note: we have to make sure to *copy* all current state and not leak any views, otherwise leader/follower
         //       interactions would get intertwined leading to inconsistencies.
         final Map<LocalHistoryIdentifier, LocalFrontendHistory> histories = new HashMap<>();
index e787edb..db0fcf5 100644 (file)
@@ -14,7 +14,7 @@ import com.google.common.collect.TreeRangeSet;
 import com.google.common.primitives.UnsignedLong;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
@@ -80,7 +80,7 @@ final class FrontendHistoryMetadataBuilder implements Builder<FrontendHistoryMet
      * @param shard parent shard
      * @return Leader history state
      */
-    @Nonnull AbstractFrontendHistory toLeaderState(@Nonnull final Shard shard) {
+    @NonNull AbstractFrontendHistory toLeaderState(final @NonNull Shard shard) {
         if (identifier.getHistoryId() == 0) {
             return StandaloneFrontendHistory.recreate(shard.persistenceId(), identifier.getClientId(),
                 shard.getDataStore(), closedTransactions, purgedTransactions);
index d323b10..9f74a8e 100644 (file)
@@ -12,8 +12,8 @@ import com.google.common.collect.Collections2;
 import com.google.common.collect.Maps;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
@@ -124,7 +124,7 @@ final class FrontendMetadata extends ShardDataTreeMetadata<FrontendShardDataTree
      *
      * @return Leader frontend state
      */
-    @Nonnull Map<FrontendIdentifier, LeaderFrontendState> toLeaderState(@Nonnull final Shard shard) {
+    @NonNull Map<FrontendIdentifier, LeaderFrontendState> toLeaderState(final @NonNull Shard shard) {
         return new HashMap<>(Maps.transformValues(clients, meta -> meta.toLeaderState(shard)));
     }
 }
index daba580..16e956f 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import java.util.Optional;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
 import org.opendaylight.controller.cluster.access.commands.ExistsTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.ExistsTransactionSuccess;
@@ -41,7 +42,7 @@ final class FrontendReadOnlyTransaction extends FrontendTransaction {
     private FrontendReadOnlyTransaction(final AbstractFrontendHistory history,
             final ReadOnlyShardDataTreeTransaction transaction) {
         super(history, transaction.getIdentifier());
-        this.openTransaction = Preconditions.checkNotNull(transaction);
+        this.openTransaction = requireNonNull(transaction);
     }
 
     static FrontendReadOnlyTransaction create(final AbstractFrontendHistory history,
@@ -51,7 +52,7 @@ final class FrontendReadOnlyTransaction extends FrontendTransaction {
 
     // Sequence has already been checked
     @Override
-    @Nullable TransactionSuccess<?> doHandleRequest(final TransactionRequest<?> request, final RequestEnvelope envelope,
+    TransactionSuccess<?> doHandleRequest(final TransactionRequest<?> request, final RequestEnvelope envelope,
             final long now) throws RequestException {
         if (request instanceof ExistsTransactionRequest) {
             return handleExistsTransaction((ExistsTransactionRequest) request);
@@ -75,9 +76,8 @@ final class FrontendReadOnlyTransaction extends FrontendTransaction {
             final long now) {
         // The only valid request here is with abort protocol
         final Optional<PersistenceProtocol> optProto = request.getPersistenceProtocol();
-        Preconditions.checkArgument(optProto.isPresent(), "Commit protocol is missing in %s", request);
-        Preconditions.checkArgument(optProto.get() == PersistenceProtocol.ABORT, "Unsupported commit protocol in %s",
-                request);
+        checkArgument(optProto.isPresent(), "Commit protocol is missing in %s", request);
+        checkArgument(optProto.get() == PersistenceProtocol.ABORT, "Unsupported commit protocol in %s", request);
         openTransaction.abort(() -> recordAndSendSuccess(envelope, now,
             new ModifyTransactionSuccess(request.getTarget(), request.getSequence())));
     }
index 28ab70a..f24d0ee 100644 (file)
@@ -7,13 +7,15 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.primitives.UnsignedLong;
 import com.google.common.util.concurrent.FutureCallback;
 import java.util.Collection;
 import java.util.Optional;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.ExistsTransactionRequest;
@@ -72,7 +74,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         final RequestException cause;
 
         Failed(final RequestException cause) {
-            this.cause = Preconditions.checkNotNull(cause);
+            this.cause = requireNonNull(cause);
         }
 
         @Override
@@ -85,7 +87,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         final ReadWriteShardDataTreeTransaction openTransaction;
 
         Open(final ReadWriteShardDataTreeTransaction openTransaction) {
-            this.openTransaction = Preconditions.checkNotNull(openTransaction);
+            this.openTransaction = requireNonNull(openTransaction);
         }
 
         @Override
@@ -99,7 +101,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         CommitStage stage;
 
         Ready(final ShardDataTreeCohort readyCohort) {
-            this.readyCohort = Preconditions.checkNotNull(readyCohort);
+            this.readyCohort = requireNonNull(readyCohort);
             this.stage = CommitStage.READY;
         }
 
@@ -113,7 +115,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         final DataTreeModification sealedModification;
 
         Sealed(final DataTreeModification sealedModification) {
-            this.sealedModification = Preconditions.checkNotNull(sealedModification);
+            this.sealedModification = requireNonNull(sealedModification);
         }
 
         @Override
@@ -184,7 +186,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
 
     // Sequence has already been checked
     @Override
-    @Nullable TransactionSuccess<?> doHandleRequest(final TransactionRequest<?> request, final RequestEnvelope envelope,
+    TransactionSuccess<?> doHandleRequest(final TransactionRequest<?> request, final RequestEnvelope envelope,
             final long now) throws RequestException {
         if (request instanceof ModifyTransactionRequest) {
             return handleModifyTransaction((ModifyTransactionRequest) request, envelope, now);
@@ -556,8 +558,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         }
     }
 
-    @Nullable
-    private TransactionSuccess<?> handleModifyTransaction(final ModifyTransactionRequest request,
+    private @Nullable TransactionSuccess<?> handleModifyTransaction(final ModifyTransactionRequest request,
             final RequestEnvelope envelope, final long now) throws RequestException {
         // We need to examine the persistence protocol first to see if this is an idempotent request. If there is no
         // protocol, there is nothing for us to do.
@@ -619,20 +620,17 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
     }
 
     private ReadWriteShardDataTreeTransaction checkOpen() {
-        Preconditions.checkState(state instanceof Open, "%s expect to be open, is in state %s", getIdentifier(),
-            state);
+        checkState(state instanceof Open, "%s expect to be open, is in state %s", getIdentifier(), state);
         return ((Open) state).openTransaction;
     }
 
     private Ready checkReady() {
-        Preconditions.checkState(state instanceof Ready, "%s expect to be ready, is in state %s", getIdentifier(),
-            state);
+        checkState(state instanceof Ready, "%s expect to be ready, is in state %s", getIdentifier(), state);
         return (Ready) state;
     }
 
     private DataTreeModification checkSealed() {
-        Preconditions.checkState(state instanceof Sealed, "%s expect to be sealed, is in state %s", getIdentifier(),
-            state);
+        checkState(state instanceof Sealed, "%s expect to be sealed, is in state %s", getIdentifier(), state);
         return ((Sealed) state).sealedModification;
     }
 
index 25cb174..b5cd587 100644 (file)
@@ -13,8 +13,8 @@ import com.google.common.base.Verify;
 import java.util.ArrayDeque;
 import java.util.Optional;
 import java.util.Queue;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.commands.IncrementTransactionSequenceRequest;
 import org.opendaylight.controller.cluster.access.commands.IncrementTransactionSequenceSuccess;
 import org.opendaylight.controller.cluster.access.commands.OutOfOrderRequestException;
@@ -120,9 +120,8 @@ abstract class FrontendTransaction implements Identifiable<TransactionIdentifier
 
     // Request order has already been checked by caller and replaySequence()
     @SuppressWarnings("checkstyle:IllegalCatch")
-    @Nullable
-    final TransactionSuccess<?> handleRequest(final TransactionRequest<?> request, final RequestEnvelope envelope,
-            final long now) throws RequestException {
+    final @Nullable TransactionSuccess<?> handleRequest(final TransactionRequest<?> request,
+            final RequestEnvelope envelope, final long now) throws RequestException {
         if (request instanceof IncrementTransactionSequenceRequest) {
             final IncrementTransactionSequenceRequest incr = (IncrementTransactionSequenceRequest) request;
             expectedSequence += incr.getIncrement();
@@ -151,8 +150,7 @@ abstract class FrontendTransaction implements Identifiable<TransactionIdentifier
         }
     }
 
-    @Nullable
-    abstract TransactionSuccess<?> doHandleRequest(TransactionRequest<?> request, RequestEnvelope envelope,
+    abstract @Nullable TransactionSuccess<?> doHandleRequest(TransactionRequest<?> request, RequestEnvelope envelope,
             long now) throws RequestException;
 
     abstract void retire();
index 7611b02..3628efb 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.commands.CreateLocalHistoryRequest;
 import org.opendaylight.controller.cluster.access.commands.DeadHistoryException;
 import org.opendaylight.controller.cluster.access.commands.DestroyLocalHistoryRequest;
@@ -79,12 +80,12 @@ final class LeaderFrontendState implements Identifiable<ClientIdentifier> {
     LeaderFrontendState(final String persistenceId, final ClientIdentifier clientId, final ShardDataTree tree,
         final UnsignedLongRangeSet purgedHistories, final AbstractFrontendHistory standaloneHistory,
         final Map<LocalHistoryIdentifier, LocalFrontendHistory> localHistories) {
-        this.persistenceId = Preconditions.checkNotNull(persistenceId);
-        this.clientId = Preconditions.checkNotNull(clientId);
-        this.tree = Preconditions.checkNotNull(tree);
-        this.purgedHistories = Preconditions.checkNotNull(purgedHistories);
-        this.standaloneHistory = Preconditions.checkNotNull(standaloneHistory);
-        this.localHistories = Preconditions.checkNotNull(localHistories);
+        this.persistenceId = requireNonNull(persistenceId);
+        this.clientId = requireNonNull(clientId);
+        this.tree = requireNonNull(tree);
+        this.purgedHistories = requireNonNull(purgedHistories);
+        this.standaloneHistory = requireNonNull(standaloneHistory);
+        this.localHistories = requireNonNull(localHistories);
         this.lastSeenTicks = tree.readTime();
     }
 
index 6610983..791c3ef 100644 (file)
@@ -7,10 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorSelection;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.mdsal.dom.spi.store.AbstractSnapshotBackedTransactionChain;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
@@ -34,9 +34,9 @@ final class LocalTransactionChain extends AbstractSnapshotBackedTransactionChain
     private final DataTree tree;
 
     LocalTransactionChain(final TransactionChainProxy parent, final ActorSelection leader, final DataTree tree) {
-        this.parent = Preconditions.checkNotNull(parent);
-        this.leader = Preconditions.checkNotNull(leader);
-        this.tree = Preconditions.checkNotNull(tree);
+        this.parent = requireNonNull(parent);
+        this.leader = requireNonNull(leader);
+        this.tree = requireNonNull(tree);
     }
 
     DataTree getDataTree() {
@@ -83,9 +83,8 @@ final class LocalTransactionChain extends AbstractSnapshotBackedTransactionChain
 
     @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
     @Override
-    public LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
-            @Nullable Exception operationError) {
-        Preconditions.checkArgument(tx instanceof SnapshotBackedWriteTransaction);
+    public LocalThreePhaseCommitCohort onTransactionReady(DOMStoreWriteTransaction tx, Exception operationError) {
+        checkArgument(tx instanceof SnapshotBackedWriteTransaction);
         if (operationError != null) {
             return new LocalChainThreePhaseCommitCohort((SnapshotBackedWriteTransaction<TransactionIdentifier>)tx,
                     operationError);
index 4834590..78046bc 100644 (file)
@@ -11,8 +11,6 @@ import static com.google.common.base.Preconditions.checkArgument;
 import static java.util.Objects.requireNonNull;
 
 import akka.actor.ActorSelection;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
@@ -77,8 +75,7 @@ final class LocalTransactionFactoryImpl extends TransactionReadyPrototype<Transa
 
     @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
     @Override
-    public LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
-            @Nullable Exception operationError) {
+    public LocalThreePhaseCommitCohort onTransactionReady(DOMStoreWriteTransaction tx, Exception operationError) {
         checkArgument(tx instanceof SnapshotBackedWriteTransaction);
         if (operationError != null) {
             return new LocalThreePhaseCommitCohort(actorUtils, leader,
index 9fc53a8..103af19 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
 
 /**
@@ -17,6 +17,6 @@ import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
  * @author Thomas Pantelis
  */
 interface LocalTransactionReadySupport {
-    LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
+    LocalThreePhaseCommitCohort onTransactionReady(@NonNull DOMStoreWriteTransaction tx,
             @Nullable Exception operationError);
 }
index 51ee4d7..98b0243 100644 (file)
@@ -30,8 +30,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.controller.cluster.access.commands.ConnectClientRequest;
 import org.opendaylight.controller.cluster.access.commands.ConnectClientSuccess;
@@ -460,8 +460,7 @@ public class Shard extends RaftActor {
     }
 
     // Acquire our frontend tracking handle and verify generation matches
-    @Nullable
-    private LeaderFrontendState findFrontend(final ClientIdentifier clientId) throws RequestException {
+    private @Nullable LeaderFrontendState findFrontend(final ClientIdentifier clientId) throws RequestException {
         final LeaderFrontendState existing = knownFrontends.get(clientId.getFrontendId());
         if (existing != null) {
             final int cmp = Long.compareUnsigned(existing.getIdentifier().getGeneration(), clientId.getGeneration());
@@ -495,8 +494,7 @@ public class Shard extends RaftActor {
         throw new OutOfSequenceEnvelopeException(0);
     }
 
-    @Nonnull
-    private static ABIVersion selectVersion(final ConnectClientRequest message) {
+    private static @NonNull ABIVersion selectVersion(final ConnectClientRequest message) {
         final Range<ABIVersion> clientRange = Range.closed(message.getMinVersion(), message.getMaxVersion());
         for (ABIVersion v : SUPPORTED_ABIVERSIONS) {
             if (clientRange.contains(v)) {
@@ -544,8 +542,7 @@ public class Shard extends RaftActor {
         }
     }
 
-    @Nullable
-    private RequestSuccess<?, ?> handleRequest(final RequestEnvelope envelope, final long now)
+    private @Nullable RequestSuccess<?, ?> handleRequest(final RequestEnvelope envelope, final long now)
             throws RequestException {
         // We are not the leader, hence we want to fail-fast.
         if (!isLeader() || paused || !isLeaderActive()) {
@@ -844,7 +841,6 @@ public class Shard extends RaftActor {
     }
 
     @Override
-    @Nonnull
     protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
         if (restoreFromSnapshot == null) {
             return ShardRecoveryCoordinator.create(store, persistenceId(), LOG);
index 403a968..bfb4165 100644 (file)
@@ -22,7 +22,7 @@ import java.util.Deque;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.BatchedModifications;
@@ -311,7 +311,7 @@ final class ShardCommitCoordinator {
         });
     }
 
-    void finishCommit(@Nonnull final ActorRef sender, @Nonnull final CohortEntry cohortEntry) {
+    void finishCommit(final @NonNull ActorRef sender, final @NonNull CohortEntry cohortEntry) {
         log.debug("{}: Finishing commit for transaction {}", persistenceId(), cohortEntry.getTransactionId());
 
         cohortEntry.commit(new FutureCallback<UnsignedLong>() {
index c93cb50..5ca0acb 100644 (file)
@@ -40,9 +40,9 @@ import java.util.concurrent.TimeoutException;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.UnaryOperator;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.DataTreeCohortActorRegistry.CohortRegistryCommand;
@@ -221,7 +221,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
      *
      * @return A state snapshot
      */
-    @Nonnull ShardDataTreeSnapshot takeStateSnapshot() {
+    @NonNull ShardDataTreeSnapshot takeStateSnapshot() {
         final NormalizedNode<?, ?> rootNode = dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY).get();
         final Builder<Class<? extends ShardDataTreeSnapshotMetadata<?>>, ShardDataTreeSnapshotMetadata<?>> metaBuilder =
                 ImmutableMap.builder();
@@ -240,7 +240,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         return !pendingTransactions.isEmpty() || !pendingCommits.isEmpty() || !pendingFinishCommits.isEmpty();
     }
 
-    private void applySnapshot(@Nonnull final ShardDataTreeSnapshot snapshot,
+    private void applySnapshot(final @NonNull ShardDataTreeSnapshot snapshot,
             final UnaryOperator<DataTreeModification> wrapper) throws DataValidationFailedException {
         final Stopwatch elapsed = Stopwatch.createStarted();
 
@@ -291,7 +291,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
      * @param snapshot Snapshot that needs to be applied
      * @throws DataValidationFailedException when the snapshot fails to apply
      */
-    void applySnapshot(@Nonnull final ShardDataTreeSnapshot snapshot) throws DataValidationFailedException {
+    void applySnapshot(final @NonNull ShardDataTreeSnapshot snapshot) throws DataValidationFailedException {
         applySnapshot(snapshot, UnaryOperator.identity());
     }
 
@@ -313,7 +313,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
      * @param snapshot Snapshot that needs to be applied
      * @throws DataValidationFailedException when the snapshot fails to apply
      */
-    void applyRecoverySnapshot(@Nonnull final ShardDataTreeSnapshot snapshot) throws DataValidationFailedException {
+    void applyRecoverySnapshot(final @NonNull ShardDataTreeSnapshot snapshot) throws DataValidationFailedException {
         applySnapshot(snapshot, this::wrapWithPruning);
     }
 
@@ -347,7 +347,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
      * @throws IOException when the snapshot fails to deserialize
      * @throws DataValidationFailedException when the snapshot fails to apply
      */
-    void applyRecoveryPayload(@Nonnull final Payload payload) throws IOException {
+    void applyRecoveryPayload(final @NonNull Payload payload) throws IOException {
         if (payload instanceof CommitTransactionPayload) {
             final Entry<TransactionIdentifier, DataTreeCandidate> e =
                     ((CommitTransactionPayload) payload).getCandidate();
@@ -446,7 +446,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
         }
     }
 
-    private void replicatePayload(final Identifier id, final Payload payload, @Nullable final Runnable callback) {
+    private void replicatePayload(final Identifier id, final Payload payload, final @Nullable Runnable callback) {
         if (callback != null) {
             replicationCallbacks.put(payload, callback);
         }
@@ -535,7 +535,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     ShardDataTreeTransactionChain ensureTransactionChain(final LocalHistoryIdentifier historyId,
-            @Nullable final Runnable callback) {
+            final @Nullable Runnable callback) {
         ShardDataTreeTransactionChain chain = transactionChains.get(historyId);
         if (chain == null) {
             chain = new ShardDataTreeTransactionChain(historyId, this);
@@ -590,7 +590,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
      * @param id History identifier
      * @param callback Callback to invoke upon completion, may be null
      */
-    void closeTransactionChain(final LocalHistoryIdentifier id, @Nullable final Runnable callback) {
+    void closeTransactionChain(final LocalHistoryIdentifier id, final @Nullable Runnable callback) {
         final ShardDataTreeTransactionChain chain = transactionChains.get(id);
         if (chain == null) {
             LOG.debug("{}: Closing non-existent transaction chain {}", logContext, id);
@@ -611,7 +611,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
      * @param id History identifier
      * @param callback Callback to invoke upon completion, may be null
      */
-    void purgeTransactionChain(final LocalHistoryIdentifier id, @Nullable final Runnable callback) {
+    void purgeTransactionChain(final LocalHistoryIdentifier id, final @Nullable Runnable callback) {
         final ShardDataTreeTransactionChain chain = transactionChains.remove(id);
         if (chain == null) {
             LOG.debug("{}: Purging non-existent transaction chain {}", logContext, id);
@@ -1233,7 +1233,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    private void rebaseTransactions(final Iterator<CommitEntry> iter, @Nonnull final DataTreeTip newTip) {
+    private void rebaseTransactions(final Iterator<CommitEntry> iter, final @NonNull DataTreeTip newTip) {
         tip = Preconditions.checkNotNull(newTip);
         while (iter.hasNext()) {
             final SimpleShardDataTreeCohort cohort = iter.next().cohort;
index e2c1b27..e2ca7ca 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import com.google.common.base.Verify;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.persisted.ShardDataTreeSnapshotMetadata;
@@ -20,7 +20,7 @@ abstract class ShardDataTreeMetadata<T extends ShardDataTreeSnapshotMetadata<T>>
      *
      * @param snapshot Metadata snapshot
      */
-    final void applySnapshot(@Nonnull final ShardDataTreeSnapshotMetadata<?> snapshot) {
+    final void applySnapshot(final @NonNull ShardDataTreeSnapshotMetadata<?> snapshot) {
         Verify.verify(getSupportedType().isInstance(snapshot), "Snapshot %s misrouted to handler of %s", snapshot,
             getSupportedType());
         doApplySnapshot(getSupportedType().cast(snapshot));
@@ -37,23 +37,21 @@ abstract class ShardDataTreeMetadata<T extends ShardDataTreeSnapshotMetadata<T>>
      *
      * @param snapshot Metadata snapshot
      */
-    abstract void doApplySnapshot(@Nonnull T snapshot);
+    abstract void doApplySnapshot(@NonNull T snapshot);
 
     /**
      * Return the type of metadata snapshot this object supports.
      *
      * @return Metadata type
      */
-    @Nonnull
-    abstract Class<T> getSupportedType();
+    abstract @NonNull Class<T> getSupportedType();
 
     /**
      * Take a snapshot of current metadata state.
      *
      * @return Metadata snapshot, or null if the metadata is empty.
      */
-    @Nullable
-    abstract T toSnapshot();
+    abstract @Nullable T toSnapshot();
 
     // Lifecycle events
 
index eea201e..9a439bd 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.Cancellable;
 import akka.actor.Status.Failure;
@@ -31,11 +33,11 @@ class ShardTransactionMessageRetrySupport implements Closeable {
     private final Set<MessageInfo> messagesToRetry = new LinkedHashSet<>();
     private final Shard shard;
 
-    ShardTransactionMessageRetrySupport(Shard shard) {
+    ShardTransactionMessageRetrySupport(final Shard shard) {
         this.shard = shard;
     }
 
-    void addMessageToRetry(Object message, ActorRef replyTo, String failureMessage) {
+    void addMessageToRetry(final Object message, final ActorRef replyTo, final String failureMessage) {
         LOG.debug("{}: Adding message {} to retry", shard.persistenceId(), message);
 
         MessageInfo messageInfo = new MessageInfo(message, replyTo, failureMessage);
@@ -61,7 +63,7 @@ class ShardTransactionMessageRetrySupport implements Closeable {
         }
     }
 
-    void onTimerMessage(Object message) {
+    void onTimerMessage(final Object message) {
         MessageInfo messageInfo = (MessageInfo)message;
 
         LOG.debug("{}: Timer expired for message {}", shard.persistenceId(), messageInfo.message);
@@ -85,18 +87,18 @@ class ShardTransactionMessageRetrySupport implements Closeable {
         final String failureMessage;
         Cancellable timer;
 
-        MessageInfo(Object message, ActorRef replyTo, String failureMessage) {
+        MessageInfo(final Object message, final ActorRef replyTo, final String failureMessage) {
             this.message = message;
             this.replyTo = replyTo;
-            this.failureMessage = failureMessage;
+            this.failureMessage = requireNonNull(failureMessage);
         }
 
-        void retry(Shard shard) {
+        void retry(final Shard shard) {
             timer.cancel();
             shard.getSelf().tell(message, replyTo);
         }
 
-        void timedOut(Shard shard) {
+        void timedOut(final Shard shard) {
             replyTo.tell(new Failure(new NoShardLeaderException(failureMessage, shard.persistenceId())),
                     shard.getSelf());
         }
index b5b49c2..f42af0b 100644 (file)
@@ -17,7 +17,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import java.util.Optional;
 import java.util.SortedSet;
 import java.util.concurrent.CompletionStage;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
@@ -32,8 +32,7 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort {
     private final ShardDataTree dataTree;
     private final TransactionIdentifier transactionId;
     private final CompositeDataTreeCohort userCohorts;
-    @Nullable
-    private final SortedSet<String> participatingShardNames;
+    private final @Nullable SortedSet<String> participatingShardNames;
 
     private State state = State.READY;
     private DataTreeCandidateTip candidate;
index 8beb44d..4ac3f9c 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.RangeSet;
 import com.google.common.collect.TreeRangeSet;
@@ -16,6 +17,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 import java.util.SortedSet;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
@@ -36,16 +38,16 @@ final class StandaloneFrontendHistory extends AbstractFrontendHistory {
             final RangeSet<UnsignedLong> purgedTransactions) {
         super(persistenceId, tree, closedTransactions, purgedTransactions);
         this.identifier = new LocalHistoryIdentifier(clientId, 0);
-        this.tree = Preconditions.checkNotNull(tree);
+        this.tree = requireNonNull(tree);
     }
 
-    static StandaloneFrontendHistory create(final String persistenceId, final ClientIdentifier clientId,
+    static @NonNull StandaloneFrontendHistory create(final String persistenceId, final ClientIdentifier clientId,
             final ShardDataTree tree) {
         return new StandaloneFrontendHistory(persistenceId, clientId, tree, ImmutableMap.of(),
             TreeRangeSet.create());
     }
 
-    static StandaloneFrontendHistory recreate(final String persistenceId, final ClientIdentifier clientId,
+    static @NonNull StandaloneFrontendHistory recreate(final String persistenceId, final ClientIdentifier clientId,
             final ShardDataTree tree, final Map<UnsignedLong, Boolean> closedTransactions,
             final RangeSet<UnsignedLong> purgedTransactions) {
         return new StandaloneFrontendHistory(persistenceId, clientId, tree, new HashMap<>(closedTransactions),
index ad6cc3e..b5806d6 100644 (file)
@@ -18,7 +18,6 @@ import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain;
@@ -323,7 +322,7 @@ final class TransactionChainProxy extends AbstractTransactionContextFactory<Loca
     }
 
     @Override
-    protected void onTransactionContextCreated(@Nonnull TransactionIdentifier transactionId) {
+    protected void onTransactionContextCreated(TransactionIdentifier transactionId) {
         Promise<Object> promise = priorReadOnlyTxPromises.remove(transactionId);
         if (promise != null) {
             promise.success(null);
index 2040420..78faaa1 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore.compat;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
 import org.opendaylight.controller.md.sal.common.api.MappingCheckedFuture;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -95,22 +96,22 @@ public class LegacyDOMStoreAdapter extends ForwardingObject implements DOMStore,
         private final org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction writeDelegate;
         private final Object identifier;
 
-        DOMStoreTransactionAdapter(@Nonnull org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction readDelegate) {
-            this.readDelegate = Preconditions.checkNotNull(readDelegate);
+        DOMStoreTransactionAdapter(org.opendaylight.mdsal.dom.spi.store.@NonNull DOMStoreReadTransaction readDelegate) {
+            this.readDelegate = requireNonNull(readDelegate);
             this.identifier = readDelegate.getIdentifier();
             this.writeDelegate = null;
         }
 
         DOMStoreTransactionAdapter(
-                @Nonnull org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction writeDelegate) {
-            this.writeDelegate = Preconditions.checkNotNull(writeDelegate);
+                org.opendaylight.mdsal.dom.spi.store.@NonNull DOMStoreWriteTransaction writeDelegate) {
+            this.writeDelegate = requireNonNull(writeDelegate);
             this.identifier = writeDelegate.getIdentifier();
             this.readDelegate = null;
         }
 
         DOMStoreTransactionAdapter(
-                @Nonnull org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction rwDelegate) {
-            this.readDelegate = Preconditions.checkNotNull(rwDelegate);
+                org.opendaylight.mdsal.dom.spi.store.@NonNull DOMStoreReadWriteTransaction rwDelegate) {
+            this.readDelegate = requireNonNull(rwDelegate);
             this.writeDelegate = rwDelegate;
             this.identifier = readDelegate.getIdentifier();
         }
index d5878c6..a2e1957 100644 (file)
@@ -5,14 +5,13 @@
  * 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.config;
 
 import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
@@ -22,32 +21,32 @@ public interface Configuration {
     /**
      * Returns all the shard names that belong on the member by the given name.
      */
-    @Nonnull Collection<String> getMemberShardNames(@Nonnull MemberName memberName);
+    @NonNull Collection<String> getMemberShardNames(@NonNull MemberName memberName);
 
     /**
      * Returns the module name for the given namespace name or null if not found.
      */
-    @Nullable String getModuleNameFromNameSpace(@Nonnull String nameSpace);
+    @Nullable String getModuleNameFromNameSpace(@NonNull String nameSpace);
 
     /**
      * Returns the first shard name corresponding to the given module name or null if none is configured.
      */
-    @Nullable String getShardNameForModule(@Nonnull String moduleName);
+    @Nullable String getShardNameForModule(@NonNull String moduleName);
 
     /**
      * Return the shard name corresponding to the prefix, or null if none is configured.
      */
-    @Nullable String getShardNameForPrefix(@Nonnull DOMDataTreeIdentifier prefix);
+    @Nullable String getShardNameForPrefix(@NonNull DOMDataTreeIdentifier prefix);
 
     /**
      * Returns the member replicas for the given shard name.
      */
-    @Nonnull Collection<MemberName> getMembersFromShardName(@Nonnull String shardName);
+    @NonNull Collection<MemberName> getMembersFromShardName(@NonNull String shardName);
 
     /**
      * Returns the ShardStrategy for the given module name or null if the module is not found.
      */
-    @Nullable ShardStrategy getStrategyForModule(@Nonnull String moduleName);
+    @Nullable ShardStrategy getStrategyForModule(@NonNull String moduleName);
 
     /**
      * Returns all the configured shard names.
@@ -57,17 +56,17 @@ public interface Configuration {
     /**
      * Adds a new configuration for a module and shard.
      */
-    void addModuleShardConfiguration(@Nonnull ModuleShardConfiguration config);
+    void addModuleShardConfiguration(@NonNull ModuleShardConfiguration config);
 
     /**
      * Adds a new configuration for a shard based on prefix.
      */
-    void addPrefixShardConfiguration(@Nonnull PrefixShardConfiguration config);
+    void addPrefixShardConfiguration(@NonNull PrefixShardConfiguration config);
 
     /**
      * Removes a shard configuration for the specified prefix.
      */
-    void removePrefixShardConfiguration(@Nonnull DOMDataTreeIdentifier prefix);
+    void removePrefixShardConfiguration(@NonNull DOMDataTreeIdentifier prefix);
 
     /**
      * Returns the configuration for all configured prefix shards.
@@ -99,5 +98,5 @@ public interface Configuration {
     /**
      * Returns the ShardStrategy for the given prefix or null if the prefix is not found.
      */
-    @Nullable ShardStrategy getStrategyForPrefix(@Nonnull DOMDataTreeIdentifier prefix);
+    @Nullable ShardStrategy getStrategyForPrefix(@NonNull DOMDataTreeIdentifier prefix);
 }
index 0007d09..7588b6d 100644 (file)
@@ -5,7 +5,6 @@
  * 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.config;
 
 import com.google.common.base.Preconditions;
@@ -21,8 +20,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.shardstrategy.PrefixShardStrategy;
 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
@@ -120,9 +117,8 @@ public class ConfigurationImpl implements Configuration {
         return !shardConfigs.isEmpty() ? shardConfigs.iterator().next().getName() : null;
     }
 
-    @Nullable
     @Override
-    public String getShardNameForPrefix(@Nonnull final DOMDataTreeIdentifier prefix) {
+    public String getShardNameForPrefix(final DOMDataTreeIdentifier prefix) {
         Preconditions.checkNotNull(prefix, "prefix should not be null");
 
         Entry<DOMDataTreeIdentifier, PrefixShardConfiguration> bestMatchEntry =
@@ -196,7 +192,7 @@ public class ConfigurationImpl implements Configuration {
     }
 
     @Override
-    public void addPrefixShardConfiguration(@Nonnull final PrefixShardConfiguration config) {
+    public void addPrefixShardConfiguration(final PrefixShardConfiguration config) {
         Preconditions.checkNotNull(config, "PrefixShardConfiguration cannot be null");
         addPrefixConfig(config);
         allShardNames = ImmutableSet.<String>builder().addAll(allShardNames)
@@ -204,7 +200,7 @@ public class ConfigurationImpl implements Configuration {
     }
 
     @Override
-    public void removePrefixShardConfiguration(@Nonnull final DOMDataTreeIdentifier prefix) {
+    public void removePrefixShardConfiguration(final DOMDataTreeIdentifier prefix) {
         Preconditions.checkNotNull(prefix, "Prefix cannot be null");
 
         removePrefixConfig(prefix);
@@ -275,7 +271,7 @@ public class ConfigurationImpl implements Configuration {
     }
 
     @Override
-    public ShardStrategy getStrategyForPrefix(@Nonnull final DOMDataTreeIdentifier prefix) {
+    public ShardStrategy getStrategyForPrefix(final DOMDataTreeIdentifier prefix) {
         Preconditions.checkNotNull(prefix, "Prefix cannot be null");
         // FIXME using prefix tables like in mdsal will be better
         Entry<DOMDataTreeIdentifier, PrefixShardConfiguration> bestMatchEntry =
index 5b4e2ff..ccd7dd6 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore.config;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableMap;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
 
@@ -30,39 +31,33 @@ public final class ModuleConfig {
 
     ModuleConfig(final String name, final String namespace, final ShardStrategy shardStrategy,
             final Map<String, ShardConfig> shardConfigs) {
-        this.name = name;
+        this.name = requireNonNull(name);
         this.namespace = namespace;
         this.shardStrategy = shardStrategy;
         this.shardConfigs = shardConfigs;
     }
 
-    @Nonnull
-    public String getName() {
+    public @NonNull String getName() {
         return name;
     }
 
-    @Nullable
-    public String getNamespace() {
+    public @Nullable String getNamespace() {
         return namespace;
     }
 
-    @Nullable
-    public ShardStrategy getShardStrategy() {
+    public @Nullable ShardStrategy getShardStrategy() {
         return shardStrategy;
     }
 
-    @Nullable
-    public ShardConfig getShardConfig(final String forName) {
+    public @Nullable ShardConfig getShardConfig(final String forName) {
         return shardConfigs.get(forName);
     }
 
-    @Nonnull
-    public Collection<ShardConfig> getShardConfigs() {
+    public @NonNull Collection<ShardConfig> getShardConfigs() {
         return shardConfigs.values();
     }
 
-    @Nonnull
-    public Collection<String> getShardNames() {
+    public @NonNull Collection<String> getShardNames() {
         return shardConfigs.keySet();
     }
 
@@ -114,8 +109,7 @@ public final class ModuleConfig {
         }
 
         public ModuleConfig build() {
-            return new ModuleConfig(Preconditions.checkNotNull(name), nameSpace, shardStrategy,
-                    ImmutableMap.copyOf(shardConfigs));
+            return new ModuleConfig(name, nameSpace, shardStrategy, ImmutableMap.copyOf(shardConfigs));
         }
     }
 }
index 1fc31f5..e113759 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.datastore.config;
 
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Interface for a class that provides module and shard configuration information.
@@ -19,5 +19,5 @@ public interface ModuleShardConfigProvider {
     /**
      * Returns a Map of ModuleConfig Builder instances keyed by module name.
      */
-    @Nonnull Map<String, ModuleConfig.Builder> retrieveModuleConfigs(@Nonnull Configuration configuration);
+    @NonNull Map<String, ModuleConfig.Builder> retrieveModuleConfigs(@NonNull Configuration configuration);
 }
index f52687f..d858b5f 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore.config;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.net.URI;
 import java.util.Collection;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 
 /**
@@ -36,13 +37,13 @@ public class ModuleShardConfiguration {
      *                          is used.
      * @param shardMemberNames the names of the shard's member replicas.
      */
-    public ModuleShardConfiguration(@Nonnull URI namespace, @Nonnull String moduleName, @Nonnull String shardName,
-            @Nullable String shardStrategyName, @Nonnull Collection<MemberName> shardMemberNames) {
-        this.namespace = Preconditions.checkNotNull(namespace, "nameSpace should not be null");
-        this.moduleName = Preconditions.checkNotNull(moduleName, "moduleName should not be null");
-        this.shardName = Preconditions.checkNotNull(shardName, "shardName should not be null");
+    public ModuleShardConfiguration(@NonNull URI namespace, @NonNull String moduleName, @NonNull String shardName,
+            @Nullable String shardStrategyName, @NonNull Collection<MemberName> shardMemberNames) {
+        this.namespace = requireNonNull(namespace, "nameSpace should not be null");
+        this.moduleName = requireNonNull(moduleName, "moduleName should not be null");
+        this.shardName = requireNonNull(shardName, "shardName should not be null");
         this.shardStrategyName = shardStrategyName;
-        this.shardMemberNames = Preconditions.checkNotNull(shardMemberNames, "shardMemberNames");
+        this.shardMemberNames = requireNonNull(shardMemberNames, "shardMemberNames");
     }
 
     public URI getNamespace() {
index 59240a0..0fe1233 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore.config;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 
 /**
@@ -21,18 +22,16 @@ public class ShardConfig {
     private final String name;
     private final Set<MemberName> replicas;
 
-    public ShardConfig(@Nonnull final String name, @Nonnull final Collection<MemberName> replicas) {
-        this.name = Preconditions.checkNotNull(name);
-        this.replicas = ImmutableSet.copyOf(Preconditions.checkNotNull(replicas));
+    public ShardConfig(final @NonNull String name, final @NonNull Collection<MemberName> replicas) {
+        this.name = requireNonNull(name);
+        this.replicas = ImmutableSet.copyOf(replicas);
     }
 
-    @Nonnull
-    public String getName() {
+    public @NonNull String getName() {
         return name;
     }
 
-    @Nonnull
-    public Set<MemberName> getReplicas() {
+    public @NonNull Set<MemberName> getReplicas() {
         return replicas;
     }
 }
\ No newline at end of file
index ab4d9b2..2dab37c 100644 (file)
@@ -23,7 +23,6 @@ import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.config.Configuration;
 import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
@@ -213,7 +212,7 @@ public class DistributedEntityOwnershipService implements DOMEntityOwnershipServ
     }
 
     @Override
-    public boolean isCandidateRegistered(@Nonnull final DOMEntity entity) {
+    public boolean isCandidateRegistered(final DOMEntity entity) {
         return registeredEntities.get(entity) != null;
     }
 
index f3adfbd..a343d73 100644 (file)
@@ -18,7 +18,7 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Queue;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.FrontendType;
@@ -226,8 +226,7 @@ class EntityOwnershipShardCommitCoordinator {
         }
     }
 
-    @Nullable
-    private BatchedModifications pruneModifications(BatchedModifications toPrune) {
+    private @Nullable BatchedModifications pruneModifications(BatchedModifications toPrune) {
         BatchedModifications prunedModifications = new BatchedModifications(toPrune.getTransactionId(),
                 toPrune.getVersion());
         prunedModifications.setDoCommitOnReady(toPrune.isDoCommitOnReady());
index 442aba0..b09356d 100644 (file)
@@ -5,7 +5,6 @@
  * 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.entityownership;
 
 import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.entityTypeFromEntityPath;
@@ -15,7 +14,6 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
-import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
@@ -37,7 +35,7 @@ class EntityOwnershipStatistics extends AbstractEntityOwnerChangeListener {
     }
 
     @Override
-    public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+    public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
         for (DataTreeCandidate change : changes) {
             DataTreeCandidateNode changeRoot = change.getRootNode();
             LeafNode<?> ownerLeaf = (LeafNode<?>) changeRoot.getDataAfter().get();
index 38899ec..38cfabb 100644 (file)
@@ -5,11 +5,10 @@
  * 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.entityownership.selectionstrategy;
 
 import java.util.Collection;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * An EntityOwnerSelectionStrategy is to be used by the EntityOwnershipShard to select a new owner from a collection
index 7102cbb..5bd78ff 100644 (file)
@@ -5,7 +5,6 @@
  * 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.entityownership.selectionstrategy;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -15,7 +14,6 @@ import com.google.common.base.Strings;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nullable;
 
 /**
  * The LeastLoadedCandidateSelectionStrategy assigns ownership for an entity to the candidate which owns the least
@@ -31,7 +29,7 @@ public class LeastLoadedCandidateSelectionStrategy extends AbstractEntityOwnerSe
     }
 
     @Override
-    public String newOwner(@Nullable String currentOwner, Collection<String> viableCandidates) {
+    public String newOwner(String currentOwner, Collection<String> viableCandidates) {
         Preconditions.checkArgument(viableCandidates.size() > 0);
         String leastLoadedCandidate = null;
         long leastLoadedCount = Long.MAX_VALUE;
index 0ea2e3c..205de93 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.datastore.exceptions;
 
 import com.google.common.base.Strings;
-import javax.annotation.Nullable;
+import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 
 /**
  * Exception indicating a shard has no current leader.
@@ -18,12 +18,16 @@ import javax.annotation.Nullable;
 public class NoShardLeaderException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
-    public NoShardLeaderException(String message) {
+    public NoShardLeaderException(final String message) {
         super(message);
     }
 
-    public NoShardLeaderException(@Nullable String message, String shardName) {
+    public NoShardLeaderException(final String message, final String shardName) {
         super(String.format("%sShard %s currently has no leader. Try again later.",
-                (Strings.isNullOrEmpty(message) ? "" : message + ". "), shardName));
+                Strings.isNullOrEmpty(message) ? "" : message + ". ", shardName));
+    }
+
+    public NoShardLeaderException(final ShardIdentifier shardId) {
+        this("Shard " + shardId + " currently has no leader. Try again later.");
     }
 }
index bdf125e..17f4ba6 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.datastore.Shard;
 
 /**
@@ -21,7 +21,7 @@ public final class ShardMBeanFactory {
     }
 
     public static ShardStats getShardStatsMBean(final String shardName, final String mxBeanType,
-            @Nonnull final Shard shard) {
+            final @NonNull Shard shard) {
         String finalMXBeanType = mxBeanType != null ? mxBeanType : "DistDataStore";
         ShardStats shardStatsMBeanImpl = new ShardStats(shardName, finalMXBeanType, shard);
         shardStatsMBeanImpl.registerMBean();
index 5a4cc98..b323476 100644 (file)
@@ -5,7 +5,6 @@
  * 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.jmx.mbeans.shard;
 
 import akka.actor.ActorRef;
@@ -15,8 +14,8 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.Shard;
 import org.opendaylight.controller.cluster.raft.base.messages.InitiateCaptureSnapshot;
 import org.opendaylight.controller.cluster.raft.client.messages.FollowerInfo;
@@ -31,6 +30,7 @@ import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
 public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
     public static final String JMX_CATEGORY_SHARD = "Shards";
 
+    // FIXME: migrate this to Java 8 thread-safe time
     @GuardedBy("DATE_FORMAT")
     private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
 
@@ -64,7 +64,7 @@ public class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
 
     private long lastLeadershipChangeTime;
 
-    public ShardStats(final String shardName, final String mxBeanType, @Nullable final Shard shard) {
+    public ShardStats(final String shardName, final String mxBeanType, final @Nullable Shard shard) {
         super(shardName, mxBeanType, JMX_CATEGORY_SHARD);
         this.shard = shard;
         stateCache = new OnDemandShardStateCache(shardName, shard != null ? shard.self() : null);
index 05e1271..ba25c0c 100644 (file)
@@ -5,11 +5,11 @@
  * 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.messages;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
@@ -27,8 +27,8 @@ public class AddPrefixShardReplica {
      * @param prefix prefix of the shard that is to be locally replicated.
      */
 
-    public AddPrefixShardReplica(@Nonnull final YangInstanceIdentifier prefix) {
-        this.prefix = Preconditions.checkNotNull(prefix, "prefix should not be null");
+    public AddPrefixShardReplica(final @NonNull YangInstanceIdentifier prefix) {
+        this.prefix = requireNonNull(prefix, "prefix should not be null");
     }
 
     public YangInstanceIdentifier getShardPrefix() {
index c902846..d8121bc 100644 (file)
@@ -5,11 +5,11 @@
  * 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.messages;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A message sent to the ShardManager to dynamically add a new local shard
@@ -26,9 +26,8 @@ public class AddShardReplica {
      *
      * @param shardName name of the shard that is to be locally replicated.
      */
-
-    public AddShardReplica(@Nonnull String shardName) {
-        this.shardName = Preconditions.checkNotNull(shardName, "ShardName should not be null");
+    public AddShardReplica(@NonNull String shardName) {
+        this.shardName = requireNonNull(shardName, "ShardName should not be null");
     }
 
     public String getShardName() {
index b38cd87..77d2687 100644 (file)
@@ -16,7 +16,7 @@ import java.io.ObjectOutput;
 import java.util.Optional;
 import java.util.SortedSet;
 import java.util.TreeSet;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
 import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification;
@@ -33,8 +33,8 @@ public class BatchedModifications extends MutableCompositeModification {
     private boolean doCommitOnReady;
     private int totalMessagesSent;
     private TransactionIdentifier transactionId;
-    @Nullable
-    private SortedSet<String> participatingShardNames;
+
+    private @Nullable SortedSet<String> participatingShardNames;
 
     public BatchedModifications() {
     }
index 3721551..8c5cbad 100644 (file)
@@ -7,11 +7,13 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.Shard;
+import org.opendaylight.controller.cluster.datastore.Shard.AbstractBuilder;
 import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
 
 /**
@@ -31,25 +33,22 @@ public class CreateShard {
      * @param shardBuilder used to obtain the Props for creating the shard actor instance.
      * @param datastoreContext the DatastoreContext for the new shard. If null, the default is used.
      */
-    public CreateShard(@Nonnull ModuleShardConfiguration moduleShardConfig,
-            @Nonnull Shard.AbstractBuilder<?, ?> shardBuilder, @Nullable DatastoreContext datastoreContext) {
-        this.moduleShardConfig = Preconditions.checkNotNull(moduleShardConfig);
-        this.shardBuilder = Preconditions.checkNotNull(shardBuilder);
+    public CreateShard(@NonNull ModuleShardConfiguration moduleShardConfig, @NonNull AbstractBuilder<?, ?> shardBuilder,
+            @Nullable DatastoreContext datastoreContext) {
+        this.moduleShardConfig = requireNonNull(moduleShardConfig);
+        this.shardBuilder = requireNonNull(shardBuilder);
         this.datastoreContext = datastoreContext;
     }
 
-    @Nonnull
-    public ModuleShardConfiguration getModuleShardConfig() {
+    public @NonNull ModuleShardConfiguration getModuleShardConfig() {
         return moduleShardConfig;
     }
 
-    @Nonnull
-    public Shard.AbstractBuilder<?, ?> getShardBuilder() {
+    public @NonNull AbstractBuilder<?, ?> getShardBuilder() {
         return shardBuilder;
     }
 
-    @Nullable
-    public DatastoreContext getDatastoreContext() {
+    public @Nullable DatastoreContext getDatastoreContext() {
         return datastoreContext;
     }
 
index 529b7e2..2042e49 100644 (file)
@@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull;
 
 import java.util.Optional;
 import java.util.SortedSet;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.ReadWriteShardDataTreeTransaction;
 
@@ -25,8 +25,7 @@ public class ForwardedReadyTransaction {
     private final ReadWriteShardDataTreeTransaction transaction;
     private final boolean doImmediateCommit;
     private final short txnClientVersion;
-    @Nullable
-    private final SortedSet<String> participatingShardNames;
+    private @Nullable final SortedSet<String> participatingShardNames;
 
     public ForwardedReadyTransaction(TransactionIdentifier transactionId, short txnClientVersion,
             ReadWriteShardDataTreeTransaction transaction, boolean doImmediateCommit,
index 0ca4f64..76d404b 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
 import org.apache.commons.lang3.ObjectUtils;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 
 /**
@@ -22,18 +23,16 @@ public class LocalPrimaryShardFound {
     private final String primaryPath;
     private final DataTree localShardDataTree;
 
-    public LocalPrimaryShardFound(@Nonnull String primaryPath, @Nonnull DataTree localShardDataTree) {
-        this.primaryPath = Preconditions.checkNotNull(primaryPath);
-        this.localShardDataTree = Preconditions.checkNotNull(localShardDataTree);
+    public LocalPrimaryShardFound(@NonNull  String primaryPath, @NonNull  DataTree localShardDataTree) {
+        this.primaryPath = requireNonNull(primaryPath);
+        this.localShardDataTree = requireNonNull(localShardDataTree);
     }
 
-    @Nonnull
-    public String getPrimaryPath() {
+    public @NonNull String getPrimaryPath() {
         return primaryPath;
     }
 
-    @Nonnull
-    public DataTree getLocalShardDataTree() {
+    public @NonNull DataTree getLocalShardDataTree() {
         return localShardDataTree;
     }
 
index f739e1e..4ecb8c4 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorSelection;
-import com.google.common.base.Preconditions;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 
 /**
@@ -23,15 +24,15 @@ public class PrimaryShardInfo {
     private final short primaryShardVersion;
     private final DataTree localShardDataTree;
 
-    public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, short primaryShardVersion,
-            @Nonnull DataTree localShardDataTree) {
-        this.primaryShardActor = Preconditions.checkNotNull(primaryShardActor);
+    public PrimaryShardInfo(@NonNull ActorSelection primaryShardActor, short primaryShardVersion,
+            @NonNull DataTree localShardDataTree) {
+        this.primaryShardActor = requireNonNull(primaryShardActor);
         this.primaryShardVersion = primaryShardVersion;
-        this.localShardDataTree = Preconditions.checkNotNull(localShardDataTree);
+        this.localShardDataTree = requireNonNull(localShardDataTree);
     }
 
-    public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, short primaryShardVersion) {
-        this.primaryShardActor = Preconditions.checkNotNull(primaryShardActor);
+    public PrimaryShardInfo(@NonNull ActorSelection primaryShardActor, short primaryShardVersion) {
+        this.primaryShardActor = requireNonNull(primaryShardActor);
         this.primaryShardVersion = primaryShardVersion;
         this.localShardDataTree = null;
     }
@@ -39,8 +40,7 @@ public class PrimaryShardInfo {
     /**
      * Returns an ActorSelection representing the primary shard actor.
      */
-    @Nonnull
-    public ActorSelection getPrimaryShardActor() {
+    public @NonNull ActorSelection getPrimaryShardActor() {
         return primaryShardActor;
     }
 
@@ -55,8 +55,7 @@ public class PrimaryShardInfo {
      * Returns an Optional whose value contains the primary shard's DataTree if the primary shard is local
      * to the caller. Otherwise the Optional value is absent.
      */
-    @Nonnull
-    public Optional<DataTree> getLocalShardDataTree() {
+    public @NonNull Optional<DataTree> getLocalShardDataTree() {
         return Optional.ofNullable(localShardDataTree);
     }
 }
index bff6ea8..d2957a4 100644 (file)
@@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull;
 
 import java.util.Optional;
 import java.util.SortedSet;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
@@ -27,8 +27,7 @@ public final class ReadyLocalTransaction {
     private final DataTreeModification modification;
     private final TransactionIdentifier transactionId;
     private final boolean doCommitOnReady;
-    @Nullable
-    private final SortedSet<String> participatingShardNames;
+    private final @Nullable SortedSet<String> participatingShardNames;
 
     // The version of the remote system used only when needing to convert to BatchedModifications.
     private short remoteVersion = DataStoreVersions.CURRENT_VERSION;
index 041085f..20b85d7 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A remote message sent to locate the primary shard.
@@ -23,13 +24,12 @@ public class RemoteFindPrimary extends FindPrimary {
 
     private final Set<String> visitedAddresses;
 
-    public RemoteFindPrimary(String shardName, boolean waitUntilReady, @Nonnull Collection<String> visitedAddresses) {
+    public RemoteFindPrimary(String shardName, boolean waitUntilReady, @NonNull Collection<String> visitedAddresses) {
         super(shardName, waitUntilReady);
-        this.visitedAddresses = new HashSet<>(Preconditions.checkNotNull(visitedAddresses));
+        this.visitedAddresses = new HashSet<>(requireNonNull(visitedAddresses));
     }
 
-    @Nonnull
-    public Set<String> getVisitedAddresses() {
+    public @NonNull Set<String> getVisitedAddresses() {
         return visitedAddresses;
     }
 }
index 9c33cf0..3721ef1 100644 (file)
@@ -5,11 +5,11 @@
  * 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.messages;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
@@ -27,10 +27,10 @@ public class RemovePrefixShardReplica {
      *
      * @param prefix prefix of the local shard that is to be dynamically removed.
      */
-    public RemovePrefixShardReplica(@Nonnull final YangInstanceIdentifier prefix,
-                                    @Nonnull final MemberName memberName) {
-        this.prefix = Preconditions.checkNotNull(prefix, "prefix should not be null");
-        this.memberName = Preconditions.checkNotNull(memberName, "memberName should not be null");
+    public RemovePrefixShardReplica(final @NonNull YangInstanceIdentifier prefix,
+                                    final @NonNull MemberName memberName) {
+        this.prefix = requireNonNull(prefix, "prefix should not be null");
+        this.memberName = requireNonNull(memberName, "memberName should not be null");
     }
 
     public YangInstanceIdentifier getShardPrefix() {
index 0325ee9..5da3a20 100644 (file)
@@ -5,11 +5,11 @@
  * 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.messages;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 
 /**
@@ -26,9 +26,9 @@ public class RemoveShardReplica {
      *
      * @param shardName name of the local shard that is to be dynamically removed.
      */
-    public RemoveShardReplica(@Nonnull String shardName, @Nonnull MemberName memberName) {
-        this.shardName = Preconditions.checkNotNull(shardName, "shardName should not be null");
-        this.memberName = Preconditions.checkNotNull(memberName, "memberName should not be null");
+    public RemoveShardReplica(@NonNull String shardName, @NonNull MemberName memberName) {
+        this.shardName = requireNonNull(shardName, "shardName should not be null");
+        this.memberName = requireNonNull(memberName, "memberName should not be null");
     }
 
     public String getShardName() {
index f5a2101..1f75550 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Preconditions;
 import com.google.common.base.Verify;
 import com.google.common.io.ByteStreams;
@@ -16,7 +18,7 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.Identifier;
@@ -59,21 +61,19 @@ public abstract class AbstractIdentifiablePayload<T extends Identifier>
             return Verify.verifyNotNull(createObject(identifier, serialized));
         }
 
-        @Nonnull
-        protected abstract T readIdentifier(@Nonnull DataInput in) throws IOException;
+        protected abstract @NonNull T readIdentifier(@NonNull DataInput in) throws IOException;
 
-        @Nonnull
         @SuppressWarnings("checkstyle:hiddenField")
-        protected abstract Identifiable<T> createObject(@Nonnull T identifier, @Nonnull byte[] serialized);
+        protected abstract @NonNull Identifiable<T> createObject(@NonNull T identifier, byte @NonNull[] serialized);
     }
 
     private static final long serialVersionUID = 1L;
     private final byte[] serialized;
     private final T identifier;
 
-    AbstractIdentifiablePayload(@Nonnull final T identifier, @Nonnull final byte[] serialized) {
-        this.identifier = Preconditions.checkNotNull(identifier);
-        this.serialized = Preconditions.checkNotNull(serialized);
+    AbstractIdentifiablePayload(final @NonNull T identifier, final byte @NonNull[] serialized) {
+        this.identifier = requireNonNull(identifier);
+        this.serialized = requireNonNull(serialized);
     }
 
     @Override
@@ -90,7 +90,6 @@ public abstract class AbstractIdentifiablePayload<T extends Identifier>
         return Verify.verifyNotNull(externalizableProxy(serialized));
     }
 
-    @Nonnull
     @SuppressWarnings("checkstyle:hiddenField")
-    protected abstract AbstractProxy<T> externalizableProxy(@Nonnull byte[] serialized);
+    protected abstract @NonNull AbstractProxy<T> externalizableProxy(byte @NonNull[] serialized);
 }
index 997fa45..e634a2d 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Abstract base exception used for reporting version mismatches from {@link PayloadVersion}.
@@ -19,12 +20,13 @@ import javax.annotation.Nonnull;
 @Beta
 public abstract class AbstractVersionException extends Exception {
     private static final long serialVersionUID = 1L;
-    private final PayloadVersion closestVersion;
+
+    private final @NonNull PayloadVersion closestVersion;
     private final int version;
 
     AbstractVersionException(final String message, final short version, final PayloadVersion closestVersion) {
         super(message);
-        this.closestVersion = Preconditions.checkNotNull(closestVersion);
+        this.closestVersion = requireNonNull(closestVersion);
         this.version = Short.toUnsignedInt(version);
     }
 
@@ -42,9 +44,7 @@ public abstract class AbstractVersionException extends Exception {
      *
      * @return Closest supported {@link PayloadVersion}
      */
-    @Nonnull
-    public final PayloadVersion getClosestVersion() {
+    public final @NonNull PayloadVersion getClosestVersion() {
         return closestVersion;
     }
-
 }
index 7ebb005..6d1c8ca 100644 (file)
@@ -12,7 +12,7 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -60,16 +60,14 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
      *
      * @return The root node.
      */
-    @Nonnull
-    abstract NormalizedNode<?, ?> rootNode();
+    abstract @NonNull NormalizedNode<?, ?> rootNode();
 
     /**
      * Return the snapshot payload version. Implementations of this method should return a constant.
      *
      * @return Snapshot payload version
      */
-    @Nonnull
-    abstract PayloadVersion version();
+    abstract @NonNull PayloadVersion version();
 
     private void versionedSerialize(final ObjectOutput out, final PayloadVersion version) throws IOException {
         switch (version) {
index 37d4125..6330e5d 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableList;
 import java.io.Externalizable;
 import java.io.IOException;
@@ -16,8 +17,8 @@ import java.io.ObjectOutput;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
 /**
@@ -78,25 +79,22 @@ public class DatastoreSnapshot implements Serializable {
     private final ShardManagerSnapshot shardManagerSnapshot;
     private final List<ShardSnapshot> shardSnapshots;
 
-    public DatastoreSnapshot(@Nonnull String type, @Nullable ShardManagerSnapshot shardManagerSnapshot,
-            @Nonnull List<ShardSnapshot> shardSnapshots) {
-        this.type = Preconditions.checkNotNull(type);
+    public DatastoreSnapshot(@NonNull String type, @Nullable ShardManagerSnapshot shardManagerSnapshot,
+            @NonNull List<ShardSnapshot> shardSnapshots) {
+        this.type = requireNonNull(type);
         this.shardManagerSnapshot = shardManagerSnapshot;
-        this.shardSnapshots = ImmutableList.copyOf(Preconditions.checkNotNull(shardSnapshots));
+        this.shardSnapshots = ImmutableList.copyOf(shardSnapshots);
     }
 
-    @Nonnull
-    public String getType() {
+    public @NonNull String getType() {
         return type;
     }
 
-    @Nullable
-    public ShardManagerSnapshot getShardManagerSnapshot() {
+    public @Nullable ShardManagerSnapshot getShardManagerSnapshot() {
         return shardManagerSnapshot;
     }
 
-    @Nonnull
-    public List<ShardSnapshot> getShardSnapshots() {
+    public @NonNull List<ShardSnapshot> getShardSnapshots() {
         return shardSnapshots;
     }
 
@@ -142,18 +140,16 @@ public class DatastoreSnapshot implements Serializable {
         private final String name;
         private final Snapshot snapshot;
 
-        public ShardSnapshot(@Nonnull String name, @Nonnull Snapshot snapshot) {
-            this.name = Preconditions.checkNotNull(name);
-            this.snapshot = Preconditions.checkNotNull(snapshot);
+        public ShardSnapshot(@NonNull String name, @NonNull Snapshot snapshot) {
+            this.name = requireNonNull(name);
+            this.snapshot = requireNonNull(snapshot);
         }
 
-        @Nonnull
-        public String getName() {
+        public @NonNull String getName() {
             return name;
         }
 
-        @Nonnull
-        public Snapshot getSnapshot() {
+        public @NonNull Snapshot getSnapshot() {
             return snapshot;
         }
 
index 1dbbcba..78f3901 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.annotations.Beta;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableObject;
 
 /**
@@ -57,7 +58,7 @@ public enum PayloadVersion implements WritableObject {
     private final short value;
 
     PayloadVersion(final int intVersion) {
-        Preconditions.checkArgument(intVersion >= 0 && intVersion <= 65535);
+        checkArgument(intVersion >= 0 && intVersion <= 65535);
         value = (short) intVersion;
     }
 
@@ -76,8 +77,7 @@ public enum PayloadVersion implements WritableObject {
      *
      * @return Current {@link PayloadVersion}
      */
-    @Nonnull
-    public static PayloadVersion current() {
+    public static @NonNull PayloadVersion current() {
         return BORON;
     }
 
@@ -90,8 +90,8 @@ public enum PayloadVersion implements WritableObject {
      * @throws FutureVersionException if the specified integer identifies a future version
      * @throws PastVersionException if the specified integer identifies a past version which is no longer supported
      */
-    @Nonnull
-    public static PayloadVersion valueOf(final short version) throws FutureVersionException, PastVersionException {
+    public static @NonNull PayloadVersion valueOf(final short version)
+            throws FutureVersionException, PastVersionException {
         switch (Short.toUnsignedInt(version)) {
             case 0:
             case 1:
@@ -119,8 +119,7 @@ public enum PayloadVersion implements WritableObject {
      * @return An {@link PayloadVersion}
      * @throws IOException If read fails or an unsupported version is encountered
      */
-    @Nonnull
-    public static PayloadVersion readFrom(@Nonnull final DataInput in) throws IOException {
+    public static @NonNull PayloadVersion readFrom(final @NonNull DataInput in) throws IOException {
         final short s = in.readShort();
         try {
             return valueOf(s);
index 3ba5a91..98302ee 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
-import com.google.common.base.Verify;
+import static com.google.common.base.Verify.verifyNotNull;
+
 import java.io.Externalizable;
 import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Base class for various bits of metadata attached to a {@link MetadataShardDataTreeSnapshot}. This class is not
@@ -38,7 +39,7 @@ public abstract class ShardDataTreeSnapshotMetadata<T extends ShardDataTreeSnaps
     }
 
     final Object writeReplace() {
-        return Verify.verifyNotNull(externalizableProxy(), "Null externalizable proxy from %s", getClass());
+        return verifyNotNull(externalizableProxy(), "Null externalizable proxy from %s", getClass());
     }
 
     /**
@@ -46,8 +47,7 @@ public abstract class ShardDataTreeSnapshotMetadata<T extends ShardDataTreeSnaps
      *
      * @return Externalizable proxy, may not be null
      */
-    @Nonnull
-    protected abstract Externalizable externalizableProxy();
+    protected abstract @NonNull Externalizable externalizableProxy();
 
     public abstract Class<T> getType();
 }
index 0c1969b..0bacbd0 100644 (file)
@@ -18,7 +18,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.datastore.config.PrefixShardConfiguration;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 
@@ -86,7 +86,7 @@ public class ShardManagerSnapshot implements Serializable {
     private final List<String> shardList;
     private final Map<DOMDataTreeIdentifier, PrefixShardConfiguration> prefixShardConfiguration;
 
-    public ShardManagerSnapshot(@Nonnull final List<String> shardList,
+    public ShardManagerSnapshot(final @NonNull List<String> shardList,
                                 final Map<DOMDataTreeIdentifier, PrefixShardConfiguration> prefixShardConfiguration) {
         this.shardList = ImmutableList.copyOf(shardList);
         this.prefixShardConfiguration = ImmutableMap.copyOf(prefixShardConfiguration);
index 8f22c0e..152ffd3 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
 /**
@@ -60,12 +61,11 @@ public class ShardSnapshotState implements Snapshot.State {
             + "aren't serialized. FindBugs does not recognize this.")
     private final ShardDataTreeSnapshot snapshot;
 
-    public ShardSnapshotState(@Nonnull final ShardDataTreeSnapshot snapshot) {
-        this.snapshot = Preconditions.checkNotNull(snapshot);
+    public ShardSnapshotState(final @NonNull ShardDataTreeSnapshot snapshot) {
+        this.snapshot = requireNonNull(snapshot);
     }
 
-    @Nonnull
-    public ShardDataTreeSnapshot getSnapshot() {
+    public @NonNull ShardDataTreeSnapshot getSnapshot() {
         return snapshot;
     }
 
index ef7e4b0..5b1f1b7 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore.shardmanager;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.serialization.Serialization;
@@ -18,7 +20,7 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.Shard;
@@ -77,9 +79,8 @@ final class ShardInformation {
     }
 
     Props newProps() {
-        Preconditions.checkNotNull(builder);
-        Props props = builder.id(shardId).peerAddresses(initialPeerAddresses).datastoreContext(datastoreContext)
-                .schemaContextProvider(schemaContextProvider).props();
+        Props props = requireNonNull(builder).id(shardId).peerAddresses(initialPeerAddresses)
+                .datastoreContext(datastoreContext).schemaContextProvider(schemaContextProvider).props();
         builder = null;
         return props;
     }
@@ -88,8 +89,7 @@ final class ShardInformation {
         return shardName;
     }
 
-    @Nullable
-    ActorRef getActor() {
+    @Nullable ActorRef getActor() {
         return actor;
     }
 
index 56bdd7f..aa3cf3f 100644 (file)
@@ -319,7 +319,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         }
     }
 
-    private void onRegisterForShardAvailabilityChanges(RegisterForShardAvailabilityChanges message) {
+    private void onRegisterForShardAvailabilityChanges(final RegisterForShardAvailabilityChanges message) {
         LOG.debug("{}: onRegisterForShardAvailabilityChanges: {}", persistenceId(), message);
 
         final Consumer<String> callback = message.getCallback();
@@ -787,7 +787,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         }
     }
 
-    private void notifyShardAvailabilityCallbacks(ShardInformation shardInformation) {
+    private void notifyShardAvailabilityCallbacks(final ShardInformation shardInformation) {
         shardAvailabilityCallbacks.forEach(callback -> callback.accept(shardInformation.getShardName()));
     }
 
@@ -804,7 +804,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             message.getSender().tell(createNotInitializedException(shardInfo.getShardId()), getSelf());
         } else {
             LOG.debug("{}: Returning NoShardLeaderException for shard {}", persistenceId(), shardInfo.getShardName());
-            message.getSender().tell(createNoShardLeaderException(shardInfo.getShardId()), getSelf());
+            message.getSender().tell(new NoShardLeaderException(shardInfo.getShardId()), getSelf());
         }
     }
 
@@ -963,7 +963,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             } else {
                 LOG.debug("{}: Returning NoShardLeaderException for shard {}", persistenceId(),
                         shardInformation.getShardName());
-                getSender().tell(createNoShardLeaderException(shardInformation.getShardId()), getSelf());
+                getSender().tell(new NoShardLeaderException(shardInformation.getShardId()), getSelf());
             }
 
             return;
@@ -972,10 +972,6 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         getSender().tell(messageSupplier.get(), getSelf());
     }
 
-    private static NoShardLeaderException createNoShardLeaderException(final ShardIdentifier shardId) {
-        return new NoShardLeaderException(null, shardId.toString());
-    }
-
     private static NotInitializedException createNotInitializedException(final ShardIdentifier shardId) {
         return new NotInitializedException(String.format(
                 "Found primary shard %s but it's not initialized yet. Please try again later", shardId));
@@ -1588,7 +1584,7 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
                         + "Possible causes - there was a problem replicating the data or shard leadership changed "
                         + "while replicating the shard data", leaderPath, shardId.getShardName()));
             case NO_LEADER:
-                return createNoShardLeaderException(shardId);
+                return new NoShardLeaderException(shardId);
             case NOT_SUPPORTED:
                 return new UnsupportedOperationException(String.format("%s request is not supported for shard %s",
                         serverChange.getSimpleName(), shardId.getShardName()));
index 5322420..d3a50fc 100644 (file)
@@ -5,14 +5,14 @@
  * 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.shardmanager;
 
 import com.google.common.collect.ImmutableList;
 import java.io.Serializable;
 import java.util.Collections;
 import java.util.List;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
+
 
 /**
  * Persisted data of the ShardManager.
@@ -24,7 +24,7 @@ public final class ShardManagerSnapshot implements Serializable {
     private static final long serialVersionUID = 1L;
     private final List<String> shardList;
 
-    ShardManagerSnapshot(@Nonnull final List<String> shardList) {
+    ShardManagerSnapshot(final @NonNull List<String> shardList) {
         this.shardList = ImmutableList.copyOf(shardList);
     }
 
@@ -39,7 +39,7 @@ public final class ShardManagerSnapshot implements Serializable {
      *             org.opendaylight.controller.cluster.datastore.ShardManagerSnapshot is removed.
      */
     @Deprecated
-    public static ShardManagerSnapshot forShardList(@Nonnull final List<String> shardList) {
+    public static ShardManagerSnapshot forShardList(final @NonNull List<String> shardList) {
         return new ShardManagerSnapshot(shardList);
     }
 
index 63b8f65..be50442 100644 (file)
@@ -5,11 +5,11 @@
  * 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.shardmanager;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nullable;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.raft.RaftState;
 
@@ -19,7 +19,7 @@ final class SwitchShardBehavior {
     private final long term;
 
     SwitchShardBehavior(final ShardIdentifier shardId, final RaftState newState, final long term) {
-        this.newState = Preconditions.checkNotNull(newState);
+        this.newState = requireNonNull(newState);
         this.shardId = shardId;
         this.term = term;
     }
index 3d4476a..b3291aa 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.controller.cluster.datastore.utils;
 import akka.dispatch.Futures;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo;
 import scala.concurrent.Future;
 
@@ -23,16 +23,15 @@ import scala.concurrent.Future;
 public class PrimaryShardInfoFutureCache {
     private final Cache<String, Future<PrimaryShardInfo>> primaryShardInfoCache = CacheBuilder.newBuilder().build();
 
-    @Nullable
-    public Future<PrimaryShardInfo> getIfPresent(@Nonnull String shardName) {
+    public @Nullable Future<PrimaryShardInfo> getIfPresent(@NonNull String shardName) {
         return primaryShardInfoCache.getIfPresent(shardName);
     }
 
-    public void putSuccessful(@Nonnull String shardName, @Nonnull PrimaryShardInfo info) {
+    public void putSuccessful(@NonNull String shardName, @NonNull PrimaryShardInfo info) {
         primaryShardInfoCache.put(shardName, Futures.successful(info));
     }
 
-    public void remove(@Nonnull String shardName) {
+    public void remove(@NonNull String shardName) {
         primaryShardInfoCache.invalidate(shardName);
     }
 }
index eda1153..c9b2c30 100644 (file)
@@ -5,11 +5,10 @@
  * 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.sharding;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Exception thrown when there was a at any point during the creation of a shard via {@link DistributedShardFactory}.
@@ -18,11 +17,11 @@ import javax.annotation.Nonnull;
 public class DOMDataTreeShardCreationFailedException extends Exception {
     private static final long serialVersionUID = 1L;
 
-    public DOMDataTreeShardCreationFailedException(@Nonnull final String message) {
+    public DOMDataTreeShardCreationFailedException(final @NonNull String message) {
         super(message);
     }
 
-    public DOMDataTreeShardCreationFailedException(@Nonnull final String message, @Nonnull final Throwable cause) {
+    public DOMDataTreeShardCreationFailedException(final @NonNull String message, final @NonNull Throwable cause) {
         super(message, cause);
     }
 }
index ba061ee..504ac10 100644 (file)
@@ -5,10 +5,11 @@
  * 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.sharding;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -19,8 +20,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
 import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
@@ -242,12 +241,12 @@ public class DistributedShardChangePublisher
 
         DOMDataTreeListenerWithSubshards(final YangInstanceIdentifier listenerPath,
                                          final DOMDataTreeChangeListener delegate) {
-            this.listenerPath = Preconditions.checkNotNull(listenerPath);
-            this.delegate = Preconditions.checkNotNull(delegate);
+            this.listenerPath = requireNonNull(listenerPath);
+            this.delegate = requireNonNull(delegate);
         }
 
         @Override
-        public synchronized void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+        public synchronized void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
             LOG.debug("Received data changed {}", changes);
 
             if (!stashedDataTreeCandidates.isEmpty()) {
@@ -300,7 +299,7 @@ public class DistributedShardChangePublisher
         }
 
         void addSubshard(final ChildShardContext context) {
-            Preconditions.checkState(context.getShard() instanceof DOMStoreTreeChangePublisher,
+            checkState(context.getShard() instanceof DOMStoreTreeChangePublisher,
                     "All subshards that are initialDataChangeEvent part of ListenerContext need to be listenable");
 
             final DOMStoreTreeChangePublisher listenableShard = (DOMStoreTreeChangePublisher) context.getShard();
@@ -324,41 +323,35 @@ public class DistributedShardChangePublisher
         private final PathArgument identifier;
 
         EmptyDataTreeCandidateNode(final PathArgument identifier) {
-            this.identifier = Preconditions.checkNotNull(identifier, "Identifier should not be null");
+            this.identifier = requireNonNull(identifier, "Identifier should not be null");
         }
 
-        @Nonnull
         @Override
         public PathArgument getIdentifier() {
             return identifier;
         }
 
-        @Nonnull
         @Override
         public Collection<DataTreeCandidateNode> getChildNodes() {
             return Collections.emptySet();
         }
 
-        @Nullable
         @Override
         @SuppressWarnings("checkstyle:hiddenField")
         public DataTreeCandidateNode getModifiedChild(final PathArgument identifier) {
             return null;
         }
 
-        @Nonnull
         @Override
         public ModificationType getModificationType() {
             return ModificationType.UNMODIFIED;
         }
 
-        @Nonnull
         @Override
         public Optional<NormalizedNode<?, ?>> getDataAfter() {
             return Optional.empty();
         }
 
-        @Nonnull
         @Override
         public Optional<NormalizedNode<?, ?>> getDataBefore() {
             return Optional.empty();
index 31bc8b6..21725d2 100644 (file)
@@ -5,16 +5,16 @@
  * 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.sharding;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
 import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
@@ -51,18 +51,18 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard {
     DistributedShardFrontend(final AbstractDataStore distributedDataStore,
                              final DataStoreClient client,
                              final DOMDataTreeIdentifier shardRoot) {
-        this.client = Preconditions.checkNotNull(client);
-        this.shardRoot = Preconditions.checkNotNull(shardRoot);
+        this.client = requireNonNull(client);
+        this.shardRoot = requireNonNull(shardRoot);
 
-        publisher = new DistributedShardChangePublisher(client, Preconditions.checkNotNull(distributedDataStore),
-                shardRoot, childShards);
+        publisher = new DistributedShardChangePublisher(client, requireNonNull(distributedDataStore), shardRoot,
+            childShards);
     }
 
     @Override
     public synchronized DOMDataTreeShardProducer createProducer(final Collection<DOMDataTreeIdentifier> paths) {
         for (final DOMDataTreeIdentifier prodPrefix : paths) {
-            Preconditions.checkArgument(shardRoot.contains(prodPrefix), "Prefix %s is not contained under shard root",
-                    prodPrefix, paths);
+            checkArgument(shardRoot.contains(prodPrefix), "Prefix %s is not contained under shard root", prodPrefix,
+                paths);
         }
 
         final ShardProxyProducer ret =
@@ -74,7 +74,7 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard {
     @Override
     public synchronized void onChildAttached(final DOMDataTreeIdentifier prefix, final DOMDataTreeShard child) {
         LOG.debug("{} : Child shard attached at {}", shardRoot, prefix);
-        Preconditions.checkArgument(child != this, "Attempted to attach child %s onto self", this);
+        checkArgument(child != this, "Attempted to attach child %s onto self", this);
         addChildShard(prefix, child);
         updateProducers();
     }
@@ -88,7 +88,7 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard {
     }
 
     private void addChildShard(final DOMDataTreeIdentifier prefix, final DOMDataTreeShard child) {
-        Preconditions.checkArgument(child instanceof WriteableDOMDataTreeShard);
+        checkArgument(child instanceof WriteableDOMDataTreeShard);
         childShards.put(prefix, new ChildShardContext(prefix, (WriteableDOMDataTreeShard) child));
     }
 
@@ -132,7 +132,6 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard {
         }
     }
 
-    @Nonnull
     @Override
     public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
             final YangInstanceIdentifier treeId, final L listener) {
index df21b90..157ee88 100644 (file)
@@ -5,7 +5,6 @@
  * 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.sharding;
 
 import static akka.actor.ActorRef.noSender;
@@ -22,7 +21,6 @@ import akka.dispatch.OnComplete;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ForwardingObject;
@@ -47,8 +45,6 @@ import java.util.concurrent.CompletionStage;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.controller.cluster.ActorSystemProvider;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
@@ -139,9 +135,9 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
     public DistributedShardedDOMDataTree(final ActorSystemProvider actorSystemProvider,
                                          final AbstractDataStore distributedOperDatastore,
                                          final AbstractDataStore distributedConfigDatastore) {
-        this.actorSystem = Preconditions.checkNotNull(actorSystemProvider).getActorSystem();
-        this.distributedOperDatastore = Preconditions.checkNotNull(distributedOperDatastore);
-        this.distributedConfigDatastore = Preconditions.checkNotNull(distributedConfigDatastore);
+        this.actorSystem = requireNonNull(actorSystemProvider).getActorSystem();
+        this.distributedOperDatastore = requireNonNull(distributedOperDatastore);
+        this.distributedConfigDatastore = requireNonNull(distributedConfigDatastore);
         shardedDOMDataTree = new ShardedDOMDataTree();
 
         shardedDataTreeActor = createShardedDataTreeActor(actorSystem,
@@ -273,7 +269,6 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
         return future;
     }
 
-    @Nonnull
     @Override
     public <T extends DOMDataTreeListener> ListenerRegistration<T> registerListener(
             final T listener, final Collection<DOMDataTreeIdentifier> subtrees,
@@ -287,9 +282,8 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
         return ImmutableClassToInstanceMap.of();
     }
 
-    @Nonnull
     @Override
-    public DOMDataTreeProducer createProducer(@Nonnull final Collection<DOMDataTreeIdentifier> subtrees) {
+    public DOMDataTreeProducer createProducer(final Collection<DOMDataTreeIdentifier> subtrees) {
         LOG.debug("{} - Creating producer for {}", memberName, subtrees);
         final DOMDataTreeProducer producer = shardedDOMDataTree.createProducer(subtrees);
 
@@ -332,7 +326,7 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
         final Promise<DistributedShardRegistration> shardRegistrationPromise = akka.dispatch.Futures.promise();
         Futures.addCallback(writeFuture, new FutureCallback<Void>() {
             @Override
-            public void onSuccess(@Nullable final Void result) {
+            public void onSuccess(final Void result) {
 
                 final Future<Object> ask =
                         Patterns.ask(shardedDataTreeActor, new LookupPrefixShard(prefix), SHARD_FUTURE_TIMEOUT);
@@ -435,7 +429,7 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
 
         Futures.addCallback(future, new FutureCallback<Void>() {
             @Override
-            public void onSuccess(@Nullable final Void result) {
+            public void onSuccess(final Void result) {
                 LOG.debug("{} - Succesfuly removed shard for {}", memberName, prefix);
             }
 
@@ -457,13 +451,10 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
         return shardedDOMDataTree.createProducer(prefix);
     }
 
-    @Nonnull
     @Override
     public <T extends DOMDataTreeShard> ListenerRegistration<T> registerDataTreeShard(
-            @Nonnull final DOMDataTreeIdentifier prefix,
-            @Nonnull final T shard,
-            @Nonnull final DOMDataTreeProducer producer)
-            throws DOMDataTreeShardingConflictException {
+            final DOMDataTreeIdentifier prefix, final T shard, final DOMDataTreeProducer producer)
+                    throws DOMDataTreeShardingConflictException {
 
         LOG.debug("Registering shard[{}] at prefix: {}", shard, prefix);
 
@@ -639,16 +630,14 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
             this.shardTable = requireNonNull(shardLayout);
         }
 
-        @Nonnull
         @Override
         public DOMDataTreeCursorAwareTransaction createTransaction(final boolean isolated) {
             return delegate.createTransaction(isolated);
         }
 
-        @Nonnull
         @Override
         @SuppressWarnings("checkstyle:hiddenField")
-        public DOMDataTreeProducer createProducer(@Nonnull final Collection<DOMDataTreeIdentifier> subtrees) {
+        public DOMDataTreeProducer createProducer(final Collection<DOMDataTreeIdentifier> subtrees) {
             // TODO we probably don't need to distribute this on the remote nodes since once we have this producer
             // open we surely have the rights to all the subtrees.
             return delegate.createProducer(subtrees);
@@ -676,9 +665,8 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
             return delegate;
         }
 
-        @Nonnull
         @Override
-        public CDSShardAccess getShardAccess(@Nonnull final DOMDataTreeIdentifier subtree) {
+        public CDSShardAccess getShardAccess(final DOMDataTreeIdentifier subtree) {
             checkArgument(subtrees.stream().anyMatch(dataTreeIdentifier -> dataTreeIdentifier.contains(subtree)),
                 "Subtree %s is not controlled by this producer %s", subtree, this);
 
index 232983e..87f7ed1 100644 (file)
@@ -5,15 +5,14 @@
  * 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.sharding;
 
 import static akka.actor.ActorRef.noSender;
 
 import akka.actor.ActorRef;
 import akka.actor.Status;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Base class for lookup tasks. Lookup tasks are supposed to run repeatedly
@@ -32,7 +31,7 @@ abstract class LookupTask implements Runnable {
 
     abstract void reschedule(int retries);
 
-    void tryReschedule(@Nullable final Throwable throwable) {
+    void tryReschedule(final @Nullable Throwable throwable) {
         if (retried <= maxRetries) {
             retried++;
             reschedule(retried);
@@ -41,7 +40,7 @@ abstract class LookupTask implements Runnable {
         }
     }
 
-    void fail(@Nullable final Throwable throwable) {
+    void fail(final @Nullable Throwable throwable) {
         if (throwable == null) {
             replyTo.tell(new Status.Failure(
                     new DOMDataTreeShardCreationFailedException("Unable to find the backend shard."
index 1e66728..7dbdd29 100644 (file)
@@ -19,7 +19,6 @@ import java.util.Collection;
 import java.util.EnumMap;
 import java.util.List;
 import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
 import org.opendaylight.controller.cluster.datastore.config.PrefixShardConfiguration;
@@ -89,7 +88,7 @@ public class PrefixedShardConfigUpdateHandler {
         }
 
         @Override
-        public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+        public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
             changes.forEach(this::resolveChange);
         }
 
index b78836b..ae19074 100644 (file)
@@ -5,13 +5,12 @@
  * 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.sharding;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableList;
 import java.util.Collection;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientLocalHistory;
 import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
@@ -31,13 +30,12 @@ class ShardProxyProducer implements DOMDataTreeShardProducer {
                        final Collection<DOMDataTreeIdentifier> prefixes,
                        final DataStoreClient client,
                        final DistributedShardModificationFactory modificationFactory) {
-        this.shardRoot = Preconditions.checkNotNull(shardRoot);
-        this.prefixes = ImmutableList.copyOf(Preconditions.checkNotNull(prefixes));
-        this.modificationFactory = Preconditions.checkNotNull(modificationFactory);
-        history = Preconditions.checkNotNull(client).createLocalHistory();
+        this.shardRoot = requireNonNull(shardRoot);
+        this.prefixes = ImmutableList.copyOf(prefixes);
+        this.modificationFactory = requireNonNull(modificationFactory);
+        history = requireNonNull(client).createLocalHistory();
     }
 
-    @Nonnull
     @Override
     public Collection<DOMDataTreeIdentifier> getPrefixes() {
         return prefixes;
@@ -54,7 +52,6 @@ class ShardProxyProducer implements DOMDataTreeShardProducer {
     }
 
     void setModificationFactory(final DistributedShardModificationFactory modificationFactory) {
-        this.modificationFactory = Preconditions.checkNotNull(modificationFactory);
+        this.modificationFactory = requireNonNull(modificationFactory);
     }
 }
-
index dcb74fa..a9a6ce8 100644 (file)
@@ -5,9 +5,10 @@
  * 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.sharding;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.AsyncFunction;
 import com.google.common.util.concurrent.FutureCallback;
@@ -21,7 +22,6 @@ import java.util.List;
 import java.util.Map.Entry;
 import java.util.Optional;
 import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
@@ -52,9 +52,9 @@ class ShardProxyTransaction implements DOMDataTreeShardWriteTransaction {
     ShardProxyTransaction(final DOMDataTreeIdentifier shardRoot,
                           final Collection<DOMDataTreeIdentifier> prefixes,
                           final DistributedShardModification modification) {
-        this.shardRoot = Preconditions.checkNotNull(shardRoot);
-        this.prefixes = Preconditions.checkNotNull(prefixes);
-        this.modification = Preconditions.checkNotNull(modification);
+        this.shardRoot = requireNonNull(shardRoot);
+        this.prefixes = requireNonNull(prefixes);
+        this.modification = requireNonNull(modification);
     }
 
     private DOMDataTreeWriteCursor getCursor() {
@@ -64,9 +64,8 @@ class ShardProxyTransaction implements DOMDataTreeShardWriteTransaction {
         return cursor;
     }
 
-    @Nonnull
     @Override
-    public DOMDataTreeWriteCursor createCursor(@Nonnull final DOMDataTreeIdentifier prefix) {
+    public DOMDataTreeWriteCursor createCursor(final DOMDataTreeIdentifier prefix) {
         checkAvailable(prefix);
         final YangInstanceIdentifier relativePath = toRelative(prefix.getRootIdentifier());
         final DOMDataTreeWriteCursor ret = getCursor();
index e52012b..065a0e9 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.databroker.actors.dds;
 
 import akka.actor.ActorRef;
 import akka.testkit.TestProbe;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.junit.Assert;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.controller.cluster.access.client.AbstractClientConnection;
@@ -84,20 +84,19 @@ class TransactionTester<T extends AbstractProxyTransaction> {
     private static class MockFailure extends RequestFailure<TransactionIdentifier, TransactionFailure> {
         private static final long serialVersionUID = 1L;
 
-        MockFailure(@Nonnull final TransactionIdentifier target, final long sequence,
-                            @Nonnull final RequestException cause) {
+        MockFailure(final @NonNull TransactionIdentifier target, final long sequence,
+                            final @NonNull RequestException cause) {
             super(target, sequence, cause);
         }
 
-        @Nonnull
         @Override
-        protected TransactionFailure cloneAsVersion(@Nonnull final ABIVersion targetVersion) {
+        protected TransactionFailure cloneAsVersion(final ABIVersion targetVersion) {
             throw new UnsupportedOperationException("Not implemented");
         }
 
         @Override
         protected AbstractRequestFailureProxy<TransactionIdentifier, TransactionFailure> externalizableProxy(
-                @Nonnull final ABIVersion version) {
+                final ABIVersion version) {
             throw new UnsupportedOperationException("Not implemented");
         }
     }
index ec64075..76f1ec2 100644 (file)
@@ -5,7 +5,6 @@
  * 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.utils;
 
 import java.util.Arrays;
@@ -14,7 +13,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
 import org.opendaylight.controller.cluster.datastore.config.ModuleConfig;
@@ -41,7 +39,7 @@ public class MockConfiguration extends ConfigurationImpl {
     }
 
     @Override
-    public ShardStrategy getStrategyForPrefix(@Nonnull final DOMDataTreeIdentifier prefix) {
+    public ShardStrategy getStrategyForPrefix(final DOMDataTreeIdentifier prefix) {
         return null;
     }
 }
index de41609..fecfc52 100644 (file)
@@ -23,7 +23,6 @@ import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-import javax.annotation.Nonnull;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -54,7 +53,7 @@ public class MockDataTreeChangeListener implements DOMDataTreeChangeListener {
     }
 
     @Override
-    public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+    public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
         if (changeLatch.getCount() > 0) {
             synchronized (changeList) {
                 changeList.addAll(changes);

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.