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 de4ae324892f9ec7d75ea27c2aba59e8d8dbe749..30a51dea4a5d74985010429863eba54440c1db9d 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 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;
 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;
 
     @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;
     }
         super(delegate, allocationContext);
         this.parent = parent;
     }
index cfc251d6c89e3b303171670d8a282f838e1cb6d0..6931d9accb29beeba82d8f98f8faf935febc6312 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.databroker;
 
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Optional;
 
 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;
 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 {
 
 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);
     }
 
         super(delegate, allocationContext);
     }
 
index 4d979cdf96774915289026f2c14ce391eaee5249..55b787af4c3e9860d0ce071d01ca0e4e7bb87047 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.databroker;
 
  */
 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.FinalizablePhantomReference;
 import com.google.common.base.FinalizableReferenceQueue;
-import com.google.common.base.Preconditions;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 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;
 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);
         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;
         }
 
             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;
         }
             FINALIZERS.add(new Finalizer(referent, transaction, allocationContext));
             return transaction;
         }
index 737e70d6f02194ab2decc3833a97ad00b9c22bf3..8a8623e95176a22460d81d24753ae6d271b7d934 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.databroker;
 
  */
 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;
 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 {
  */
 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);
     }
 
         super(delegate, allocationContext);
     }
 
index 4b1d613636c89f5c125e66f5cf9e21b7c2d5b1f8..80fbf037647d7a3065765079cd31abc16063c4c4 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 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;
 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.
      */
      * @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();
         @SuppressWarnings("unchecked")
         final State<T> local = STATE_UPDATER.getAndSet(this, null);
         return local == null ? null : local.values();
index 12858b9cb9fc1470349de74b925f02cced49f73a..e5d8abcb629826b4a505b3eef08136052bc57ec8 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 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;
 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")
     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,
             final long timeout, final TimeUnit unit) {
         try {
             return (DataStoreClient) Await.result(ExplicitAsk.ask(actor, GET_CLIENT_FACTORY,
index 546738fb670ec9592f7086ac4ea84c3b8f8310c1..e1919d1bb6c2a601486005425c5e5f6fe75423b4 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 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 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;
 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));
     }
 
         successfulRequests.add(Verify.verifyNotNull(req));
     }
 
index eddbba6acdd92992bf4e145c8fb3f20596fb3000..e32d1bf1cff2b29a28aba11f31b7beb0ce1ed408 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 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 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;
 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);
         }
 
             stage.whenComplete(this::onStageResolved);
         }
 
-        @Nonnull CompletionStage<ShardBackendInfo> getStage() {
+        @NonNull CompletionStage<ShardBackendInfo> getStage() {
             return stage;
         }
 
             return stage;
         }
 
-        @Nullable synchronized ShardBackendInfo getResult() {
+        synchronized @Nullable ShardBackendInfo getResult() {
             return result;
         }
 
             return result;
         }
 
index 9c0983879a799576cde9ec37ea154e9d54392bc6..46e208b0b83a4396ce5cacdb1df1755f85d2b39d 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 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;
 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);
     }
 
         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;
         }
         if (cursorToClose.equals(this.cursor)) {
             this.cursor = null;
         }
index 2032b5498401f3969c956319ca96100d995c9bcc..e3dc91cbaea2b5228ad11e91aa0ab04594dc438d 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
 import com.google.common.annotations.Beta;
 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;
 
 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
  * @author Robert Varga
  */
 @Beta
+@NonNullByDefault
 public interface DataStoreClient extends Identifiable<ClientIdentifier>, AutoCloseable {
 public interface DataStoreClient extends Identifiable<ClientIdentifier>, AutoCloseable {
-    @Override
-    @Nonnull ClientIdentifier getIdentifier();
-
     @Override
     void close();
 
     @Override
     void close();
 
@@ -34,19 +32,19 @@ public interface DataStoreClient extends Identifiable<ClientIdentifier>, AutoClo
      *
      * @return Client history handle
      */
      *
      * @return Client history handle
      */
-    @Nonnull ClientLocalHistory createLocalHistory();
+    ClientLocalHistory createLocalHistory();
 
     /**
      * Create a new free-standing snapshot.
      *
      * @return Client snapshot handle
      */
 
     /**
      * 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
      */
 
     /**
      * Create a new free-standing transaction.
      *
      * @return Client transaction handle
      */
-    @Nonnull ClientTransaction createTransaction();
+    ClientTransaction createTransaction();
 }
 }
index 719a3b13b29f798d54593b57c79bbee5acd009e4..1701d4c894b5f7fddf04ec9511e343992d14d28b 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
 import akka.actor.Props;
 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;
 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);
     }
 
         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,
         final String name = "datastore-" + storeName;
         final FrontendIdentifier frontendId = FrontendIdentifier.create(memberName, FrontendType.forName(name));
         return Props.create(DistributedDataStoreClientActor.class,
index 2a81e1d0aa37714cf208beea5d9012cf893ff96c..6679725da274d4bb85d9228863008a07a1a89097 100644 (file)
@@ -7,13 +7,15 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
  */
 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 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 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;
 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);
 
     LocalProxyTransaction(final ProxyHistory parent, final TransactionIdentifier identifier, final boolean isDone) {
         super(parent, isDone);
-        this.identifier = Preconditions.checkNotNull(identifier);
+        this.identifier = requireNonNull(identifier);
     }
 
     @Override
     }
 
     @Override
@@ -68,8 +70,7 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction {
         return identifier;
     }
 
         return identifier;
     }
 
-    @Nonnull
-    abstract DataTreeSnapshot readOnlyView();
+    abstract @NonNull DataTreeSnapshot readOnlyView();
 
     abstract void applyForwardedModifyTransactionRequest(ModifyTransactionRequest request,
             @Nullable Consumer<Response<?, ?>> callback);
 
     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) {
         // 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
     }
 
     @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)) {
         if (request instanceof ModifyTransactionRequest) {
             replayModifyTransactionRequest((ModifyTransactionRequest) request, callback, enqueuedTicks);
         } else if (handleReadRequest(request, callback)) {
index cf2ea8adcdf5f3ee570662feda581473fd0a3164..4f0290ea0cb7ddf24325b942741127a2309e0c68 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 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 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;
 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,
 
     @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,
         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,
         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) {
             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,
 
     @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) {
         LOG.debug("Applying replayed request {}", request);
 
         if (request instanceof TransactionPreCommitRequest) {
@@ -347,8 +347,7 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
         closedException = this::abortedException;
     }
 
         closedException = this::abortedException;
     }
 
-    @Nonnull
-    private CursorAwareDataTreeModification getModification() {
+    private @NonNull CursorAwareDataTreeModification getModification() {
         if (closedException != null) {
             throw closedException.get();
         }
         if (closedException != null) {
             throw closedException.get();
         }
index d36218c19e13a5eae47d10ef9bbf22ed9061ab5e..8bdf3599463684ad86d1df361324faaf154e77da 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 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;
 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
     }
 
     @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));
 
         final Consumer<Response<?, ?>> cb = callback != null ? callback : resp -> { /* NOOP */ };
         final Optional<Long> optTicks = Optional.of(Long.valueOf(enqueuedTicks));
 
index de67400f7a71bae8c41102ceee33e80302a20e7c..b19de5a4ef9cd678394e900bc6e59b408bb715a1 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 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;
 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);
     }
 
         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));
             final ActorUtils actorUtils, final String shardName) {
         final String name = "datastore-" + storeName;
         final FrontendIdentifier frontendId = FrontendIdentifier.create(memberName, FrontendType.forName(name));
index 072f8ede80c978987e78767f0df019f56efa6438..e136d50e02fc0c60f1eb3c0a44f824aed0b77615 100644 (file)
@@ -17,7 +17,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 import java.util.SortedSet;
 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;
 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();
     }
 
         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);
             final RequestEnvelope envelope, final long now) throws RequestException {
         if (request instanceof TransactionPurgeRequest) {
             return handleTransactionPurgeRequest(request, envelope, now);
index 6c4fc6097d5adf2d3d3bb771f5b67647f64b74f8..bc8efa6c5ae2b9d87dd94cac8e7386a4a6a1d06b 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 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;
 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) {
     }
 
     protected AbstractTransactionContext(TransactionIdentifier transactionIdentifier, short transactionVersion) {
+        // FIXME: requireNonNull()?
         this.transactionIdentifier = transactionIdentifier;
         this.transactionVersion = transactionVersion;
     }
         this.transactionIdentifier = transactionIdentifier;
         this.transactionVersion = transactionVersion;
     }
@@ -33,7 +34,8 @@ abstract class AbstractTransactionContext implements TransactionContext {
      *
      * @return Transaction identifier.
      */
      *
      * @return Transaction identifier.
      */
-    @Nonnull protected final TransactionIdentifier getIdentifier() {
+    // FIXME: does this imply Identifiable?
+    protected final @NonNull TransactionIdentifier getIdentifier() {
         return transactionIdentifier;
     }
 
         return transactionIdentifier;
     }
 
index a2bbc11c12d8fed3764914aa3ff0c066aee646f7..a415a8c087fc6f28e5bff6c8b0406bb03b3c6117 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 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;
 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.
      */
      * @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
 
     /**
      * 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
      */
      * 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.
      */
 
     /**
      * 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) {
 
     private static TransactionContext createLocalTransactionContext(final LocalTransactionFactory factory,
                                                                     final TransactionProxy parent) {
index 200f766b5d3619da0bc1427145a1736ee94bcd77..5e1add10a213fa4e1056ad7e7de026f0a534ff54 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 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;
 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;
 
     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,
     private State state = State.IDLE;
 
     CompositeDataTreeCohort(final DataTreeCohortActorRegistry registry, final TransactionIdentifier transactionID,
@@ -222,8 +221,7 @@ class CompositeDataTreeCohort {
         return ret;
     }
 
         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<>();
             final State currentState, final State afterState) {
         LOG.debug("{}: processResponses - currentState: {}, afterState: {}", txId, currentState, afterState);
         final CompletableFuture<Void> returnFuture = new CompletableFuture<>();
index 26c5f45568e2ca00ea1205a27175504dbe90cfc7..c8372e409e1ab6e3de0254d73fcbc0e343e2c771 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
  */
  * 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;
 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 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;
 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());
         }
 
             }, 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();
 
 
         abstract ListenableFuture<?> abort();
 
index 6270b380cb701bbcf7f513a8bfa9bacb2923ddf4..763b2e92cda777107789faa13489fcc1d9ed1c03 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 com.google.common.collect.Collections2;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
 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;
 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
      */
      * @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<>();
         // 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 e787edb7a80e391bc2d8bd900535f2b2836b8d10..db0fcf57909b9902090e68c8db92d3e7b6d67bd1 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 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;
 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
      */
      * @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);
         if (identifier.getHistoryId() == 0) {
             return StandaloneFrontendHistory.recreate(shard.persistenceId(), identifier.getClientId(),
                 shard.getDataStore(), closedTransactions, purgedTransactions);
index d323b1026d5b8661b7bf5ac44690c9aa0294dd7d..9f74a8e940898ed317fbb0d2ec9d910396268ec3 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 com.google.common.collect.Maps;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
 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;
 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
      */
      *
      * @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)));
     }
 }
         return new HashMap<>(Maps.transformValues(clients, meta -> meta.toLeaderState(shard)));
     }
 }
index daba580906064a081714a67ea427b693cf9a47a8..16e956f715949e6ccea4c281bcfce7f331ceb3bd 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 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 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;
 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());
     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,
     }
 
     static FrontendReadOnlyTransaction create(final AbstractFrontendHistory history,
@@ -51,7 +52,7 @@ final class FrontendReadOnlyTransaction extends FrontendTransaction {
 
     // Sequence has already been checked
     @Override
 
     // 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);
             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();
             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())));
     }
         openTransaction.abort(() -> recordAndSendSuccess(envelope, now,
             new ModifyTransactionSuccess(request.getTarget(), request.getSequence())));
     }
index 28ab70a351bc15b56b68e5057abea8faf721dc78..f24d0ee8a801efaa38ee93d692e10cd0bbcca6fa 100644 (file)
@@ -7,13 +7,15 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 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 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 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;
 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) {
         final RequestException cause;
 
         Failed(final RequestException cause) {
-            this.cause = Preconditions.checkNotNull(cause);
+            this.cause = requireNonNull(cause);
         }
 
         @Override
         }
 
         @Override
@@ -85,7 +87,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         final ReadWriteShardDataTreeTransaction openTransaction;
 
         Open(final ReadWriteShardDataTreeTransaction openTransaction) {
         final ReadWriteShardDataTreeTransaction openTransaction;
 
         Open(final ReadWriteShardDataTreeTransaction openTransaction) {
-            this.openTransaction = Preconditions.checkNotNull(openTransaction);
+            this.openTransaction = requireNonNull(openTransaction);
         }
 
         @Override
         }
 
         @Override
@@ -99,7 +101,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         CommitStage stage;
 
         Ready(final ShardDataTreeCohort readyCohort) {
         CommitStage stage;
 
         Ready(final ShardDataTreeCohort readyCohort) {
-            this.readyCohort = Preconditions.checkNotNull(readyCohort);
+            this.readyCohort = requireNonNull(readyCohort);
             this.stage = CommitStage.READY;
         }
 
             this.stage = CommitStage.READY;
         }
 
@@ -113,7 +115,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         final DataTreeModification sealedModification;
 
         Sealed(final DataTreeModification sealedModification) {
         final DataTreeModification sealedModification;
 
         Sealed(final DataTreeModification sealedModification) {
-            this.sealedModification = Preconditions.checkNotNull(sealedModification);
+            this.sealedModification = requireNonNull(sealedModification);
         }
 
         @Override
         }
 
         @Override
@@ -184,7 +186,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
 
     // Sequence has already been checked
     @Override
 
     // 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);
             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.
             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() {
     }
 
     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() {
         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() {
         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;
     }
 
         return ((Sealed) state).sealedModification;
     }
 
index 25cb174ea6a4085f4d767cf9ce62a85b61ae30ef..b5cd5879f74d45ddad6534213d5ae880813207a3 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 java.util.ArrayDeque;
 import java.util.Optional;
 import java.util.Queue;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
 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;
 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")
 
     // 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();
         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();
             long now) throws RequestException;
 
     abstract void retire();
index 7611b029ca53a4562753d7346f86db26daef02db..3628efb4acec7d427d03085ba32cd6eb64bc85c2 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
 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 java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.NotThreadSafe;
 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;
 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) {
     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();
     }
 
         this.lastSeenTicks = tree.readTime();
     }
 
index 66109835a7fd5f91dce45a2593f1babe3eb53a2c..791c3ef69b135f8387e3b0afb764bc7abaf70fc3 100644 (file)
@@ -7,10 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 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 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;
 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) {
     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() {
     }
 
     DataTree getDataTree() {
@@ -83,9 +83,8 @@ final class LocalTransactionChain extends AbstractSnapshotBackedTransactionChain
 
     @SuppressWarnings({"unchecked", "checkstyle:IllegalCatch"})
     @Override
 
     @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);
         if (operationError != null) {
             return new LocalChainThreePhaseCommitCohort((SnapshotBackedWriteTransaction<TransactionIdentifier>)tx,
                     operationError);
index 48345909946b64958a66c2188ebc41fb80c105a8..78046bce9be123b423b6e50d61dd79cd83f9027f 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 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;
 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
 
     @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,
         checkArgument(tx instanceof SnapshotBackedWriteTransaction);
         if (operationError != null) {
             return new LocalThreePhaseCommitCohort(actorUtils, leader,
index 9fc53a867c49bae51507eb63f22f7fa6cf2c0a31..103af19dd319cdf3041afcb8507bfce8f83818fb 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 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;
 
 /**
 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 {
  * @author Thomas Pantelis
  */
 interface LocalTransactionReadySupport {
-    LocalThreePhaseCommitCohort onTransactionReady(@Nonnull DOMStoreWriteTransaction tx,
+    LocalThreePhaseCommitCohort onTransactionReady(@NonNull DOMStoreWriteTransaction tx,
             @Nullable Exception operationError);
 }
             @Nullable Exception operationError);
 }
index 51ee4d7b80ef7c9396930984b22e44c18bbb392c..98b02432e516b045fbf957d1f6ec065ee1726ccb 100644 (file)
@@ -30,8 +30,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 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;
 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
     }
 
     // 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());
         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);
     }
 
         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)) {
         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()) {
             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
     }
 
     @Override
-    @Nonnull
     protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
         if (restoreFromSnapshot == null) {
             return ShardRecoveryCoordinator.create(store, persistenceId(), LOG);
     protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
         if (restoreFromSnapshot == null) {
             return ShardRecoveryCoordinator.create(store, persistenceId(), LOG);
index 403a96819f392726d7b24ef715827e1187f29841..bfb416534bdc1a5d0cb5efa9c36d465820b4d15d 100644 (file)
@@ -22,7 +22,7 @@ import java.util.Deque;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
 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;
 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>() {
         log.debug("{}: Finishing commit for transaction {}", persistenceId(), cohortEntry.getTransactionId());
 
         cohortEntry.commit(new FutureCallback<UnsignedLong>() {
index c93cb50f3076d738a4135be3473a9cb6dcb00641..5ca0acba4d26e6df0ec2c99699a2ea244d878cfa 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 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 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;
 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
      */
      *
      * @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();
         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();
     }
 
         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();
 
             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
      */
      * @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());
     }
 
         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
      */
      * @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);
     }
 
         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
      */
      * @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();
         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);
         }
         if (callback != null) {
             replicationCallbacks.put(payload, callback);
         }
@@ -535,7 +535,7 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     ShardDataTreeTransactionChain ensureTransactionChain(final LocalHistoryIdentifier historyId,
     }
 
     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);
         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
      */
      * @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);
         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
      */
      * @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);
         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")
     }
 
     @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;
         tip = Preconditions.checkNotNull(newTip);
         while (iter.hasNext()) {
             final SimpleShardDataTreeCohort cohort = iter.next().cohort;
index e2c1b27db1406ad0e6d2f3e1b405d1f6db33f464..e2ca7cab2c4f778b5e64cd385067f0721f716e94 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import com.google.common.base.Verify;
 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;
 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
      */
      *
      * @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));
         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
      */
      *
      * @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
      */
 
     /**
      * 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.
      */
 
     /**
      * 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
 
 
     // Lifecycle events
 
index eea201e56d55b1ecdab037d221beb1389c0c5311..9a439bd35bad6d9a86efd500be5e2d987f8f1ab9 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 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;
 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;
 
     private final Set<MessageInfo> messagesToRetry = new LinkedHashSet<>();
     private final Shard shard;
 
-    ShardTransactionMessageRetrySupport(Shard shard) {
+    ShardTransactionMessageRetrySupport(final Shard shard) {
         this.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);
         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);
         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;
 
         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.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);
         }
 
             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());
         }
             replyTo.tell(new Failure(new NoShardLeaderException(failureMessage, shard.persistenceId())),
                     shard.getSelf());
         }
index b5b49c2396c772a0fbfdd75e4bcc1ff8e14ca1cb..f42af0b88e5847c3201520cfbca632b4b2da4dcd 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 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;
 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;
     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;
 
     private State state = State.READY;
     private DataTreeCandidateTip candidate;
index 8beb44d50f89d3e6a7af4bec4d0b9afa838b5c3d..4ac3f9c1ed324d8c629c1f774866cdd618da8c80 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
  */
 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;
 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 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;
 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);
             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());
     }
 
             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),
             final ShardDataTree tree, final Map<UnsignedLong, Boolean> closedTransactions,
             final RangeSet<UnsignedLong> purgedTransactions) {
         return new StandaloneFrontendHistory(persistenceId, clientId, tree, new HashMap<>(closedTransactions),
index ad6cc3e6ed7bacfc0694fe7eb9dae5eca27b8a8d..b5806d6689a4f402208592b808a3ceaad63b3936 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 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;
 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
     }
 
     @Override
-    protected void onTransactionContextCreated(@Nonnull TransactionIdentifier transactionId) {
+    protected void onTransactionContextCreated(TransactionIdentifier transactionId) {
         Promise<Object> promise = priorReadOnlyTxPromises.remove(transactionId);
         if (promise != null) {
             promise.success(null);
         Promise<Object> promise = priorReadOnlyTxPromises.remove(transactionId);
         if (promise != null) {
             promise.success(null);
index 2040420dda42ccd8f282baf697bfc48b9eba421c..78faaa155e12fa602241d2e5336719bf082625ef 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore.compat;
 
  */
 package org.opendaylight.controller.cluster.datastore.compat;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Optional;
 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 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;
 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;
 
         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(
             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(
             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();
         }
             this.writeDelegate = rwDelegate;
             this.identifier = readDelegate.getIdentifier();
         }
index d5878c643153bb08b1ce2d881d15481dc0e0b190..a2e19579534a844c4b7cea5ee27e03a657582009 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
  */
  * 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;
 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;
 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.
      */
     /**
      * 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.
      */
 
     /**
      * 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.
      */
 
     /**
      * 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.
      */
 
     /**
      * 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.
      */
 
     /**
      * 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.
      */
 
     /**
      * 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.
 
     /**
      * Returns all the configured shard names.
@@ -57,17 +56,17 @@ public interface Configuration {
     /**
      * Adds a new configuration for a module and shard.
      */
     /**
      * 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.
      */
 
     /**
      * 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.
      */
 
     /**
      * 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.
 
     /**
      * 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.
      */
     /**
      * 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 0007d0941b1cab104f62476bc8a856ab5a643dba..7588b6d77cb53332eba19ee8d1b7e8ff8399e6bf 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
  */
  * 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;
 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 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;
 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;
     }
 
         return !shardConfigs.isEmpty() ? shardConfigs.iterator().next().getName() : null;
     }
 
-    @Nullable
     @Override
     @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 =
         Preconditions.checkNotNull(prefix, "prefix should not be null");
 
         Entry<DOMDataTreeIdentifier, PrefixShardConfiguration> bestMatchEntry =
@@ -196,7 +192,7 @@ public class ConfigurationImpl implements Configuration {
     }
 
     @Override
     }
 
     @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)
         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
     }
 
     @Override
-    public void removePrefixShardConfiguration(@Nonnull final DOMDataTreeIdentifier prefix) {
+    public void removePrefixShardConfiguration(final DOMDataTreeIdentifier prefix) {
         Preconditions.checkNotNull(prefix, "Prefix cannot be null");
 
         removePrefixConfig(prefix);
         Preconditions.checkNotNull(prefix, "Prefix cannot be null");
 
         removePrefixConfig(prefix);
@@ -275,7 +271,7 @@ public class ConfigurationImpl implements Configuration {
     }
 
     @Override
     }
 
     @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 =
         Preconditions.checkNotNull(prefix, "Prefix cannot be null");
         // FIXME using prefix tables like in mdsal will be better
         Entry<DOMDataTreeIdentifier, PrefixShardConfiguration> bestMatchEntry =
index 5b4e2ffe702a8a538d8d5876712cbb3dae5a2948..ccd7dd66065ef32b8b824a764e6cbb061c5b5db6 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore.config;
 
  */
 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 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;
 
 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) {
 
     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;
     }
 
         this.namespace = namespace;
         this.shardStrategy = shardStrategy;
         this.shardConfigs = shardConfigs;
     }
 
-    @Nonnull
-    public String getName() {
+    public @NonNull String getName() {
         return name;
     }
 
         return name;
     }
 
-    @Nullable
-    public String getNamespace() {
+    public @Nullable String getNamespace() {
         return namespace;
     }
 
         return namespace;
     }
 
-    @Nullable
-    public ShardStrategy getShardStrategy() {
+    public @Nullable ShardStrategy getShardStrategy() {
         return shardStrategy;
     }
 
         return shardStrategy;
     }
 
-    @Nullable
-    public ShardConfig getShardConfig(final String forName) {
+    public @Nullable ShardConfig getShardConfig(final String forName) {
         return shardConfigs.get(forName);
     }
 
         return shardConfigs.get(forName);
     }
 
-    @Nonnull
-    public Collection<ShardConfig> getShardConfigs() {
+    public @NonNull Collection<ShardConfig> getShardConfigs() {
         return shardConfigs.values();
     }
 
         return shardConfigs.values();
     }
 
-    @Nonnull
-    public Collection<String> getShardNames() {
+    public @NonNull Collection<String> getShardNames() {
         return shardConfigs.keySet();
     }
 
         return shardConfigs.keySet();
     }
 
@@ -114,8 +109,7 @@ public final class ModuleConfig {
         }
 
         public ModuleConfig build() {
         }
 
         public ModuleConfig build() {
-            return new ModuleConfig(Preconditions.checkNotNull(name), nameSpace, shardStrategy,
-                    ImmutableMap.copyOf(shardConfigs));
+            return new ModuleConfig(name, nameSpace, shardStrategy, ImmutableMap.copyOf(shardConfigs));
         }
     }
 }
         }
     }
 }
index 1fc31f52ff65ad8d73c684e78ef6c9a9d9267a3a..e11375943c64ec72c919cbc97ddcc52b2d379623 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.datastore.config;
 
 import java.util.Map;
 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.
 
 /**
  * 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.
      */
     /**
      * 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 f52687f698ab8d178a6fa015422269e4d7fc8e9a..d858b5f962ae0799d1adc9d00f783dea9bcfc76b 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore.config;
 
  */
 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 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;
 
 /**
 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.
      */
      *                          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.shardStrategyName = shardStrategyName;
-        this.shardMemberNames = Preconditions.checkNotNull(shardMemberNames, "shardMemberNames");
+        this.shardMemberNames = requireNonNull(shardMemberNames, "shardMemberNames");
     }
 
     public URI getNamespace() {
     }
 
     public URI getNamespace() {
index 59240a0dbb971d7b07985d8f5ae21b349a6ba01a..0fe1233b66b5c8237f3e6db320a0d4a8180b6224 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore.config;
 
  */
 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 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;
 
 /**
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 
 /**
@@ -21,18 +22,16 @@ public class ShardConfig {
     private final String name;
     private final Set<MemberName> replicas;
 
     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;
     }
 
         return name;
     }
 
-    @Nonnull
-    public Set<MemberName> getReplicas() {
+    public @NonNull Set<MemberName> getReplicas() {
         return replicas;
     }
 }
\ No newline at end of file
         return replicas;
     }
 }
\ No newline at end of file
index ab4d9b2de08998b760a84ba16d548d70823e5b37..2dab37c585ebb2ed01bb6d29640bcfd476d24590 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 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;
 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
     }
 
     @Override
-    public boolean isCandidateRegistered(@Nonnull final DOMEntity entity) {
+    public boolean isCandidateRegistered(final DOMEntity entity) {
         return registeredEntities.get(entity) != null;
     }
 
         return registeredEntities.get(entity) != null;
     }
 
index f3adfbd51e373a0f9c8a515040123f71e735a448..a343d7373f21ba1d748bba2ac879cf9737751780 100644 (file)
@@ -18,7 +18,7 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Queue;
 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;
 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());
         BatchedModifications prunedModifications = new BatchedModifications(toPrune.getTransactionId(),
                 toPrune.getVersion());
         prunedModifications.setDoCommitOnReady(toPrune.isDoCommitOnReady());
index 442aba0055aaa8900d406d6fba10d285a6fe421b..b09356dcc1c20c0964b222c8265fef3cc8360285 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
  */
  * 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;
 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 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;
 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
     }
 
     @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();
         for (DataTreeCandidate change : changes) {
             DataTreeCandidateNode changeRoot = change.getRootNode();
             LeafNode<?> ownerLeaf = (LeafNode<?>) changeRoot.getDataAfter().get();
index 38899ecc318aad351c2fe6c7369d8491fe6b535d..38cfabb18dce0d1efc5536a4b3104941145b847f 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
  */
  * 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;
 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
 
 /**
  * An EntityOwnerSelectionStrategy is to be used by the EntityOwnershipShard to select a new owner from a collection
index 7102cbbbf096be52bcc1656b39e162e6ce7bf796..5bd78ff101a09f376d858d0c1428453839695775 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
  */
  * 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;
 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 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
 
 /**
  * The LeastLoadedCandidateSelectionStrategy assigns ownership for an entity to the candidate which owns the least
@@ -31,7 +29,7 @@ public class LeastLoadedCandidateSelectionStrategy extends AbstractEntityOwnerSe
     }
 
     @Override
     }
 
     @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;
         Preconditions.checkArgument(viableCandidates.size() > 0);
         String leastLoadedCandidate = null;
         long leastLoadedCount = Long.MAX_VALUE;
index 0ea2e3c8436ba399c089e0998fef1fa8b8d82801..205de939559caaa684a2c21a7034489f5e40746d 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.datastore.exceptions;
 
 import com.google.common.base.Strings;
 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.
 
 /**
  * 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 class NoShardLeaderException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
-    public NoShardLeaderException(String message) {
+    public NoShardLeaderException(final String message) {
         super(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.",
         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 bdf125e7d45b84e41bffe47a80a84d689074de05..17f4ba66869efae16c78d04c14be90874829ecee 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
 
  */
 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;
 
 /**
 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,
     }
 
     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();
         String finalMXBeanType = mxBeanType != null ? mxBeanType : "DistDataStore";
         ShardStats shardStatsMBeanImpl = new ShardStats(shardName, finalMXBeanType, shard);
         shardStatsMBeanImpl.registerMBean();
index 5a4cc98011d146ca47b34b5dd361353b2b5c4ea3..b3234766e6eb1c17c1a1d6e3318c8c05b283b8e1 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
  */
  * 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;
 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 java.util.Date;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 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;
 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";
 
 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");
 
     @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;
 
 
     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);
         super(shardName, mxBeanType, JMX_CATEGORY_SHARD);
         this.shard = shard;
         stateCache = new OnDemandShardStateCache(shardName, shard != null ? shard.self() : null);
index 05e1271dd0439618bd7da626d39c5094db66ed93..ba25c0c3c94a6648b464152296b7d61de972b90d 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
  */
  * 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;
 
 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;
 
 /**
 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.
      */
 
      * @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() {
     }
 
     public YangInstanceIdentifier getShardPrefix() {
index c9028466d46632de7945a7d7368b885ab8ae8bfe..d8121bc0351a6a119009651e333f27d787addd5d 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
  */
  * 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;
 
 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
 
 /**
  * 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.
      */
      *
      * @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() {
     }
 
     public String getShardName() {
index b38cd873dfc777e23db5ff8f87f8b8b7ecf6c56c..77d2687ccba2a723dd5041891c8c1d8b4dbde566 100644 (file)
@@ -16,7 +16,7 @@ import java.io.ObjectOutput;
 import java.util.Optional;
 import java.util.SortedSet;
 import java.util.TreeSet;
 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;
 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;
     private boolean doCommitOnReady;
     private int totalMessagesSent;
     private TransactionIdentifier transactionId;
-    @Nullable
-    private SortedSet<String> participatingShardNames;
+
+    private @Nullable SortedSet<String> participatingShardNames;
 
     public BatchedModifications() {
     }
 
     public BatchedModifications() {
     }
index 372155107d54b105521d8774f47d5931e098ea3b..8c5cbad33088c3beceb929fa5851fe29a882dee8 100644 (file)
@@ -7,11 +7,13 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
  */
 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.DatastoreContext;
 import org.opendaylight.controller.cluster.datastore.Shard;
+import org.opendaylight.controller.cluster.datastore.Shard.AbstractBuilder;
 import org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration;
 
 /**
 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.
      */
      * @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;
     }
 
         this.datastoreContext = datastoreContext;
     }
 
-    @Nonnull
-    public ModuleShardConfiguration getModuleShardConfig() {
+    public @NonNull ModuleShardConfiguration getModuleShardConfig() {
         return moduleShardConfig;
     }
 
         return moduleShardConfig;
     }
 
-    @Nonnull
-    public Shard.AbstractBuilder<?, ?> getShardBuilder() {
+    public @NonNull AbstractBuilder<?, ?> getShardBuilder() {
         return shardBuilder;
     }
 
         return shardBuilder;
     }
 
-    @Nullable
-    public DatastoreContext getDatastoreContext() {
+    public @Nullable DatastoreContext getDatastoreContext() {
         return datastoreContext;
     }
 
         return datastoreContext;
     }
 
index 529b7e2153cb63888387b9a86dee36fd85aa3c95..2042e49d654cf75f08a320ecb8626fc6cd5b348e 100644 (file)
@@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull;
 
 import java.util.Optional;
 import java.util.SortedSet;
 
 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;
 
 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;
     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,
 
     public ForwardedReadyTransaction(TransactionIdentifier transactionId, short txnClientVersion,
             ReadWriteShardDataTreeTransaction transaction, boolean doImmediateCommit,
index 0ca4f6444da1861f382ba5dfa626fbe72f2674e1..76d404bc9c41b9e7fe1585007e4923aede93bb87 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
  */
 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.apache.commons.lang3.ObjectUtils;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 
 /**
 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;
 
     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;
     }
 
         return primaryPath;
     }
 
-    @Nonnull
-    public DataTree getLocalShardDataTree() {
+    public @NonNull DataTree getLocalShardDataTree() {
         return localShardDataTree;
     }
 
         return localShardDataTree;
     }
 
index f739e1e6c4ab66de3f958f5c39d98a241e8b9f04..4ecb8c470b9185925835f2b3f4df3717fa08e273 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorSelection;
 import akka.actor.ActorSelection;
-import com.google.common.base.Preconditions;
 import java.util.Optional;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 
 /**
 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;
 
     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.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;
     }
         this.primaryShardVersion = primaryShardVersion;
         this.localShardDataTree = null;
     }
@@ -39,8 +40,7 @@ public class PrimaryShardInfo {
     /**
      * Returns an ActorSelection representing the primary shard actor.
      */
     /**
      * Returns an ActorSelection representing the primary shard actor.
      */
-    @Nonnull
-    public ActorSelection getPrimaryShardActor() {
+    public @NonNull ActorSelection getPrimaryShardActor() {
         return primaryShardActor;
     }
 
         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.
      */
      * 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);
     }
 }
         return Optional.ofNullable(localShardDataTree);
     }
 }
index bff6ea862029a647ef96205931022491342fa76e..d2957a4a54ae51e9de8dd8a03ae27b45437947ee 100644 (file)
@@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull;
 
 import java.util.Optional;
 import java.util.SortedSet;
 
 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;
 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;
     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;
 
     // The version of the remote system used only when needing to convert to BatchedModifications.
     private short remoteVersion = DataStoreVersions.CURRENT_VERSION;
index 041085fe159154685d5b412c537591a61a02a984..20b85d7ad1d19903868f7037b968f75330145f86 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
  */
 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 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.
 
 /**
  * A remote message sent to locate the primary shard.
@@ -23,13 +24,12 @@ public class RemoteFindPrimary extends FindPrimary {
 
     private final Set<String> visitedAddresses;
 
 
     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);
         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;
     }
 }
         return visitedAddresses;
     }
 }
index 9c33cf0810ab0aa7335f243a6b9178356659a864..3721ef1a5d247c09edbd1794cb99e74091edcbe4 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
  */
  * 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;
 
 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;
 
 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.
      */
      *
      * @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() {
     }
 
     public YangInstanceIdentifier getShardPrefix() {
index 0325ee9f2baa38af39d658efcca9c6a29b7d6e22..5da3a201e88a7d71b5800eb44eed63618be89497 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
  */
  * 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;
 
 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.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.
      */
      *
      * @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() {
     }
 
     public String getShardName() {
index f5a210159fdcde3603e752b2550acb985ce4657c..1f755506a5a77f69d1947065b3b569e43a9f5b3b 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
  */
 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;
 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 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;
 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));
         }
 
             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")
         @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;
 
     }
 
     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
     }
 
     @Override
@@ -90,7 +90,6 @@ public abstract class AbstractIdentifiablePayload<T extends Identifier>
         return Verify.verifyNotNull(externalizableProxy(serialized));
     }
 
         return Verify.verifyNotNull(externalizableProxy(serialized));
     }
 
-    @Nonnull
     @SuppressWarnings("checkstyle:hiddenField")
     @SuppressWarnings("checkstyle:hiddenField")
-    protected abstract AbstractProxy<T> externalizableProxy(@Nonnull byte[] serialized);
+    protected abstract @NonNull AbstractProxy<T> externalizableProxy(byte @NonNull[] serialized);
 }
 }
index 997fa45c6b1e0bc01466c47897d2e52ad1780862..e634a2de7a029270ada915be0915e2f54baeecd9 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 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}.
 
 /**
  * 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;
 @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);
     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);
     }
 
         this.version = Short.toUnsignedInt(version);
     }
 
@@ -42,9 +44,7 @@ public abstract class AbstractVersionException extends Exception {
      *
      * @return Closest supported {@link PayloadVersion}
      */
      *
      * @return Closest supported {@link PayloadVersion}
      */
-    @Nonnull
-    public final PayloadVersion getClosestVersion() {
+    public final @NonNull PayloadVersion getClosestVersion() {
         return closestVersion;
     }
         return closestVersion;
     }
-
 }
 }
index 7ebb0055f2da2c1fcbbd9f8843ca2abc0c65e560..6d1c8caf69b55989cf8bbf0c78089c396cfe0363 100644 (file)
@@ -12,7 +12,7 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.Optional;
 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;
 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.
      */
      *
      * @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
      */
 
     /**
      * 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) {
 
     private void versionedSerialize(final ObjectOutput out, final PayloadVersion version) throws IOException {
         switch (version) {
index 37d41258585d7f99dc617f63c5a3c50d43cbacdd..6330e5d4c257343a135f62b6e9ac3a8dcd429923 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
  */
 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;
 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 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;
 
 /**
 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;
 
     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.shardManagerSnapshot = shardManagerSnapshot;
-        this.shardSnapshots = ImmutableList.copyOf(Preconditions.checkNotNull(shardSnapshots));
+        this.shardSnapshots = ImmutableList.copyOf(shardSnapshots);
     }
 
     }
 
-    @Nonnull
-    public String getType() {
+    public @NonNull String getType() {
         return type;
     }
 
         return type;
     }
 
-    @Nullable
-    public ShardManagerSnapshot getShardManagerSnapshot() {
+    public @Nullable ShardManagerSnapshot getShardManagerSnapshot() {
         return shardManagerSnapshot;
     }
 
         return shardManagerSnapshot;
     }
 
-    @Nonnull
-    public List<ShardSnapshot> getShardSnapshots() {
+    public @NonNull List<ShardSnapshot> getShardSnapshots() {
         return shardSnapshots;
     }
 
         return shardSnapshots;
     }
 
@@ -142,18 +140,16 @@ public class DatastoreSnapshot implements Serializable {
         private final String name;
         private final Snapshot snapshot;
 
         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;
         }
 
             return name;
         }
 
-        @Nonnull
-        public Snapshot getSnapshot() {
+        public @NonNull Snapshot getSnapshot() {
             return snapshot;
         }
 
             return snapshot;
         }
 
index 1dbbcba2e5e741ed107b36d44e28cf338f1ddc4d..78f390116eaa65f6be27b1ffacb0095434558298 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
  */
 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.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 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;
 
 /**
 import org.opendaylight.yangtools.concepts.WritableObject;
 
 /**
@@ -57,7 +58,7 @@ public enum PayloadVersion implements WritableObject {
     private final short value;
 
     PayloadVersion(final int intVersion) {
     private final short value;
 
     PayloadVersion(final int intVersion) {
-        Preconditions.checkArgument(intVersion >= 0 && intVersion <= 65535);
+        checkArgument(intVersion >= 0 && intVersion <= 65535);
         value = (short) intVersion;
     }
 
         value = (short) intVersion;
     }
 
@@ -76,8 +77,7 @@ public enum PayloadVersion implements WritableObject {
      *
      * @return Current {@link PayloadVersion}
      */
      *
      * @return Current {@link PayloadVersion}
      */
-    @Nonnull
-    public static PayloadVersion current() {
+    public static @NonNull PayloadVersion current() {
         return BORON;
     }
 
         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
      */
      * @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:
         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
      */
      * @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);
         final short s = in.readShort();
         try {
             return valueOf(s);
index 3ba5a91a9cd63e70333b7216966ab9e6a8fb2edb..98302ee503710f9a95cf75b31f69bea6dc5ceefd 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
  */
 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 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
 
 /**
  * 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() {
     }
 
     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
      */
      *
      * @return Externalizable proxy, may not be null
      */
-    @Nonnull
-    protected abstract Externalizable externalizableProxy();
+    protected abstract @NonNull Externalizable externalizableProxy();
 
     public abstract Class<T> getType();
 }
 
     public abstract Class<T> getType();
 }
index 0c1969b216bf550ebd17cf6d163ea119f3bc701c..0bacbd0dbc03a9873215eeb5e85708bc6bdb6497 100644 (file)
@@ -18,7 +18,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 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;
 
 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;
 
     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);
                                 final Map<DOMDataTreeIdentifier, PrefixShardConfiguration> prefixShardConfiguration) {
         this.shardList = ImmutableList.copyOf(shardList);
         this.prefixShardConfiguration = ImmutableMap.copyOf(prefixShardConfiguration);
index 8f22c0ec2dc2b2fe5bed0033b2bd18657263c27d..152ffd368fdd68b76b8cdda063860902dfbd4460 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
  */
 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 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;
 
 /**
 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;
 
             + "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;
     }
 
         return snapshot;
     }
 
index ef7e4b0cfa7ae396abee28c0c7143665eff5bb70..5b1f1b780e879de7e4229493f418469e480d327a 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore.shardmanager;
 
  */
 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;
 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 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;
 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() {
     }
 
     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;
     }
         builder = null;
         return props;
     }
@@ -88,8 +89,7 @@ final class ShardInformation {
         return shardName;
     }
 
         return shardName;
     }
 
-    @Nullable
-    ActorRef getActor() {
+    @Nullable ActorRef getActor() {
         return actor;
     }
 
         return actor;
     }
 
index 56bdd7f8ea2cb6329dbdfe9cf79f38759f0375d0..aa3cf3face4cd348500eb7d506774f8fecf8ac30 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();
         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()));
     }
 
         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(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());
             } else {
                 LOG.debug("{}: Returning NoShardLeaderException for shard {}", persistenceId(),
                         shardInformation.getShardName());
-                getSender().tell(createNoShardLeaderException(shardInformation.getShardId()), getSelf());
+                getSender().tell(new NoShardLeaderException(shardInformation.getShardId()), getSelf());
             }
 
             return;
             }
 
             return;
@@ -972,10 +972,6 @@ class ShardManager extends AbstractUntypedPersistentActorWithMetering {
         getSender().tell(messageSupplier.get(), getSelf());
     }
 
         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));
     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:
                         + "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()));
             case NOT_SUPPORTED:
                 return new UnsupportedOperationException(String.format("%s request is not supported for shard %s",
                         serverChange.getSimpleName(), shardId.getShardName()));
index 53224206702c11ddf4834ff3eb97b500b32da8f9..d3a50fcec9e46e12fce1023c9ab0f41885bba709 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
  */
  * 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;
 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.
 
 /**
  * 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;
 
     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);
     }
 
         this.shardList = ImmutableList.copyOf(shardList);
     }
 
@@ -39,7 +39,7 @@ public final class ShardManagerSnapshot implements Serializable {
      *             org.opendaylight.controller.cluster.datastore.ShardManagerSnapshot is removed.
      */
     @Deprecated
      *             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);
     }
 
         return new ShardManagerSnapshot(shardList);
     }
 
index 63b8f65d420ffb9600c148ebc33db28e0d925f63..be5044270be7077b7b6f7697877208bcdbeade1d 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
  */
  * 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;
 
 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;
 
 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) {
     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;
     }
         this.shardId = shardId;
         this.term = term;
     }
index 3d4476a972e6ee8491da4143c6fb6174bdc2d366..b3291aad2552bbe23bd9390e6768f6ff8287c306 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 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;
 
 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();
 
 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);
     }
 
         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));
     }
 
         primaryShardInfoCache.put(shardName, Futures.successful(info));
     }
 
-    public void remove(@Nonnull String shardName) {
+    public void remove(@NonNull String shardName) {
         primaryShardInfoCache.invalidate(shardName);
     }
 }
         primaryShardInfoCache.invalidate(shardName);
     }
 }
index eda11532ceba84f48c9f7c47f88e4239d4ae17af..c9b2c305848ba7c410d498c28bed21e2dba35b8b 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
  */
  * 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;
 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}.
 
 /**
  * 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 class DOMDataTreeShardCreationFailedException extends Exception {
     private static final long serialVersionUID = 1L;
 
-    public DOMDataTreeShardCreationFailedException(@Nonnull final String message) {
+    public DOMDataTreeShardCreationFailedException(final @NonNull String message) {
         super(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);
     }
 }
         super(message, cause);
     }
 }
index ba061ee400536377e7f418214fd36e4b0f2ca2a7..504ac101986ef2f1660a5943d901c20c40574d0f 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
  */
  * 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;
 
 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;
 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 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;
 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) {
 
         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
         }
 
         @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()) {
             LOG.debug("Received data changed {}", changes);
 
             if (!stashedDataTreeCandidates.isEmpty()) {
@@ -300,7 +299,7 @@ public class DistributedShardChangePublisher
         }
 
         void addSubshard(final ChildShardContext context) {
         }
 
         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();
                     "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) {
         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;
         }
 
         @Override
         public PathArgument getIdentifier() {
             return identifier;
         }
 
-        @Nonnull
         @Override
         public Collection<DataTreeCandidateNode> getChildNodes() {
             return Collections.emptySet();
         }
 
         @Override
         public Collection<DataTreeCandidateNode> getChildNodes() {
             return Collections.emptySet();
         }
 
-        @Nullable
         @Override
         @SuppressWarnings("checkstyle:hiddenField")
         public DataTreeCandidateNode getModifiedChild(final PathArgument identifier) {
             return null;
         }
 
         @Override
         @SuppressWarnings("checkstyle:hiddenField")
         public DataTreeCandidateNode getModifiedChild(final PathArgument identifier) {
             return null;
         }
 
-        @Nonnull
         @Override
         public ModificationType getModificationType() {
             return ModificationType.UNMODIFIED;
         }
 
         @Override
         public ModificationType getModificationType() {
             return ModificationType.UNMODIFIED;
         }
 
-        @Nonnull
         @Override
         public Optional<NormalizedNode<?, ?>> getDataAfter() {
             return Optional.empty();
         }
 
         @Override
         public Optional<NormalizedNode<?, ?>> getDataAfter() {
             return Optional.empty();
         }
 
-        @Nonnull
         @Override
         public Optional<NormalizedNode<?, ?>> getDataBefore() {
             return Optional.empty();
         @Override
         public Optional<NormalizedNode<?, ?>> getDataBefore() {
             return Optional.empty();
index 31bc8b6949156662cecdc9a62f116458b589eaad..21725d2c67840c3587cbeeea2832e5b907a3db89 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
  */
  * 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;
 
 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 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;
 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) {
     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) {
     }
 
     @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 =
         }
 
         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);
     @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();
     }
         addChildShard(prefix, child);
         updateProducers();
     }
@@ -88,7 +88,7 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard {
     }
 
     private void addChildShard(final DOMDataTreeIdentifier prefix, final DOMDataTreeShard child) {
     }
 
     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));
     }
 
         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) {
     @Override
     public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
             final YangInstanceIdentifier treeId, final L listener) {
index df21b901da6676e29e2bf7352e5a734228b9d965..157ee8808d5a401e25dbe236d1875186e81081c2 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
  */
  * 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;
 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 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;
 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 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;
 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) {
     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,
         shardedDOMDataTree = new ShardedDOMDataTree();
 
         shardedDataTreeActor = createShardedDataTreeActor(actorSystem,
@@ -273,7 +269,6 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
         return future;
     }
 
         return future;
     }
 
-    @Nonnull
     @Override
     public <T extends DOMDataTreeListener> ListenerRegistration<T> registerListener(
             final T listener, final Collection<DOMDataTreeIdentifier> subtrees,
     @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();
     }
 
         return ImmutableClassToInstanceMap.of();
     }
 
-    @Nonnull
     @Override
     @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);
 
         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
         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);
 
                 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
 
         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);
             }
 
                 LOG.debug("{} - Succesfuly removed shard for {}", memberName, prefix);
             }
 
@@ -457,13 +451,10 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
         return shardedDOMDataTree.createProducer(prefix);
     }
 
         return shardedDOMDataTree.createProducer(prefix);
     }
 
-    @Nonnull
     @Override
     public <T extends DOMDataTreeShard> ListenerRegistration<T> registerDataTreeShard(
     @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);
 
 
         LOG.debug("Registering shard[{}] at prefix: {}", shard, prefix);
 
@@ -639,16 +630,14 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
             this.shardTable = requireNonNull(shardLayout);
         }
 
             this.shardTable = requireNonNull(shardLayout);
         }
 
-        @Nonnull
         @Override
         public DOMDataTreeCursorAwareTransaction createTransaction(final boolean isolated) {
             return delegate.createTransaction(isolated);
         }
 
         @Override
         public DOMDataTreeCursorAwareTransaction createTransaction(final boolean isolated) {
             return delegate.createTransaction(isolated);
         }
 
-        @Nonnull
         @Override
         @SuppressWarnings("checkstyle:hiddenField")
         @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);
             // 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;
         }
 
             return delegate;
         }
 
-        @Nonnull
         @Override
         @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);
 
             checkArgument(subtrees.stream().anyMatch(dataTreeIdentifier -> dataTreeIdentifier.contains(subtree)),
                 "Subtree %s is not controlled by this producer %s", subtree, this);
 
index 232983e4e8c36f2a3397a693b0158e61c8f08222..87f7ed170f9df3de3a3b7f82e81853b5b9135b87 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
  */
  * 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;
 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 javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Base class for lookup tasks. Lookup tasks are supposed to run repeatedly
 
 /**
  * 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);
 
 
     abstract void reschedule(int retries);
 
-    void tryReschedule(@Nullable final Throwable throwable) {
+    void tryReschedule(final @Nullable Throwable throwable) {
         if (retried <= maxRetries) {
             retried++;
             reschedule(retried);
         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."
         if (throwable == null) {
             replyTo.tell(new Status.Failure(
                     new DOMDataTreeShardCreationFailedException("Unable to find the backend shard."
index 1e66728aa4272f39439432c619cfd888faa2714c..7dbdd290e69d9e6fa7be758c0d76b09387d78de2 100644 (file)
@@ -19,7 +19,6 @@ import java.util.Collection;
 import java.util.EnumMap;
 import java.util.List;
 import java.util.stream.Collectors;
 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;
 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
         }
 
         @Override
-        public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+        public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
             changes.forEach(this::resolveChange);
         }
 
             changes.forEach(this::resolveChange);
         }
 
index b78836bfa6916d8106c90f6d1d0cf545501f591d..ae1907479dd2aae9b39cbfc3eddbbdd1fed3d5ed 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
  */
  * 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;
 
 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 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;
 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) {
                        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;
     @Override
     public Collection<DOMDataTreeIdentifier> getPrefixes() {
         return prefixes;
@@ -54,7 +52,6 @@ class ShardProxyProducer implements DOMDataTreeShardProducer {
     }
 
     void setModificationFactory(final DistributedShardModificationFactory modificationFactory) {
     }
 
     void setModificationFactory(final DistributedShardModificationFactory modificationFactory) {
-        this.modificationFactory = Preconditions.checkNotNull(modificationFactory);
+        this.modificationFactory = requireNonNull(modificationFactory);
     }
 }
     }
 }
-
index dcb74fa49e6749d990131d497e16dc49efe3a160..a9a6ce836ef2ae0511d3fcdc368ba9b7d369360a 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
  */
  * 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;
 
 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;
 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 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;
 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) {
     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() {
     }
 
     private DOMDataTreeWriteCursor getCursor() {
@@ -64,9 +64,8 @@ class ShardProxyTransaction implements DOMDataTreeShardWriteTransaction {
         return cursor;
     }
 
         return cursor;
     }
 
-    @Nonnull
     @Override
     @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();
         checkAvailable(prefix);
         final YangInstanceIdentifier relativePath = toRelative(prefix.getRootIdentifier());
         final DOMDataTreeWriteCursor ret = getCursor();
index e52012b459e44035e12f0f1fba1f9367991d5e02..065a0e97fb6acb0e8af346ad821244e88320192e 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.databroker.actors.dds;
 
 import akka.actor.ActorRef;
 import akka.testkit.TestProbe;
 
 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;
 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;
 
     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);
         }
 
             super(target, sequence, cause);
         }
 
-        @Nonnull
         @Override
         @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(
             throw new UnsupportedOperationException("Not implemented");
         }
 
         @Override
         protected AbstractRequestFailureProxy<TransactionIdentifier, TransactionFailure> externalizableProxy(
-                @Nonnull final ABIVersion version) {
+                final ABIVersion version) {
             throw new UnsupportedOperationException("Not implemented");
         }
     }
             throw new UnsupportedOperationException("Not implemented");
         }
     }
index ec64075fa555fd105f9494554115c6206a0c77e8..76f1ec20f2f5322c55fe648d5ff6e9a028137ce5 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
  */
  * 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;
 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 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;
 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
     }
 
     @Override
-    public ShardStrategy getStrategyForPrefix(@Nonnull final DOMDataTreeIdentifier prefix) {
+    public ShardStrategy getStrategyForPrefix(final DOMDataTreeIdentifier prefix) {
         return null;
     }
 }
         return null;
     }
 }
index de41609ba178e41bab48bc8530eff491cdfe2e26..fecfc52fb6a57a036b009ef89502c8ed26c199a9 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 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;
 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
     }
 
     @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);
         if (changeLatch.getCount() > 0) {
             synchronized (changeList) {
                 changeList.addAll(changes);