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:
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;
@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;
}
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;
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);
}
*/
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;
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;
}
*/
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;
*/
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);
}
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;
* @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();
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;
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,
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;
- final void recordSuccessfulRequest(@Nonnull final TransactionRequest<?> req) {
+ final void recordSuccessfulRequest(final @NonNull TransactionRequest<?> req) {
successfulRequests.add(Verify.verifyNotNull(req));
}
successfulRequests.add(Verify.verifyNotNull(req));
}
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;
stage.whenComplete(this::onStageResolved);
}
stage.whenComplete(this::onStageResolved);
}
- @Nonnull CompletionStage<ShardBackendInfo> getStage() {
+ @NonNull CompletionStage<ShardBackendInfo> getStage() {
- @Nullable synchronized ShardBackendInfo getResult() {
+ synchronized @Nullable ShardBackendInfo getResult() {
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;
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;
}
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;
* @author Robert Varga
*/
@Beta
* @author Robert Varga
*/
@Beta
public interface DataStoreClient extends Identifiable<ClientIdentifier>, AutoCloseable {
public interface DataStoreClient extends Identifiable<ClientIdentifier>, AutoCloseable {
- @Override
- @Nonnull ClientIdentifier getIdentifier();
-
*
* @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();
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;
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,
*/
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;
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);
- @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);
- 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) {
- 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)) {
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;
@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) {
@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) {
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();
}
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;
- 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));
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;
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));
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;
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);
*/
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;
}
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;
}
*
* @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;
}
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;
* @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
* 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) {
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;
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,
- @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<>();
* 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;
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;
}, 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();
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;
* @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<>();
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;
* @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);
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;
*
* @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)));
}
}
*/
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;
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,
// 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);
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())));
}
*/
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;
final RequestException cause;
Failed(final RequestException cause) {
final RequestException cause;
Failed(final RequestException cause) {
- this.cause = Preconditions.checkNotNull(cause);
+ this.cause = requireNonNull(cause);
final ReadWriteShardDataTreeTransaction openTransaction;
Open(final ReadWriteShardDataTreeTransaction openTransaction) {
final ReadWriteShardDataTreeTransaction openTransaction;
Open(final ReadWriteShardDataTreeTransaction openTransaction) {
- this.openTransaction = Preconditions.checkNotNull(openTransaction);
+ this.openTransaction = requireNonNull(openTransaction);
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;
}
final DataTreeModification sealedModification;
Sealed(final DataTreeModification sealedModification) {
final DataTreeModification sealedModification;
Sealed(final DataTreeModification sealedModification) {
- this.sealedModification = Preconditions.checkNotNull(sealedModification);
+ this.sealedModification = requireNonNull(sealedModification);
// 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);
- @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.
}
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;
}
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;
// 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();
- @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();
*/
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;
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();
}
*/
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;
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() {
@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);
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;
@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,
*/
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;
/**
* @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);
}
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;
}
// 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());
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)) {
- @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()) {
protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
if (restoreFromSnapshot == null) {
return ShardRecoveryCoordinator.create(store, persistenceId(), LOG);
protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
if (restoreFromSnapshot == null) {
return ShardRecoveryCoordinator.create(store, persistenceId(), LOG);
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;
- 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>() {
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;
*
* @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();
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();
* @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());
}
* @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);
}
* @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();
- 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);
}
}
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);
* @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);
* @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);
}
@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;
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;
*
* @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));
*
* @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();
*/
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;
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) {
- 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);
- 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);
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());
}
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;
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;
*/
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;
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;
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),
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;
- 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);
*/
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;
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();
}
* 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;
/**
* 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.
/**
* 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.
/**
* 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);
* 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;
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;
return !shardConfigs.isEmpty() ? shardConfigs.iterator().next().getName() : null;
}
return !shardConfigs.isEmpty() ? shardConfigs.iterator().next().getName() : null;
}
- 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 =
- 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)
- 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);
- 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 =
*/
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;
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 = 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() {
- @Nullable
- public String getNamespace() {
+ public @Nullable String getNamespace() {
- @Nullable
- public ShardStrategy getShardStrategy() {
+ public @Nullable ShardStrategy getShardStrategy() {
- @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();
}
}
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));
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.
/**
* 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);
*/
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;
/**
* 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() {
*/
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;
/**
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() {
- @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
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;
- public boolean isCandidateRegistered(@Nonnull final DOMEntity entity) {
+ public boolean isCandidateRegistered(final DOMEntity entity) {
return registeredEntities.get(entity) != null;
}
return registeredEntities.get(entity) != null;
}
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;
- @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());
* 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;
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;
- 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();
* 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
* 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;
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
- 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;
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.
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) {
- 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.");
*/
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;
/**
}
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();
* 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;
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;
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");
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);
* 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;
/**
* @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() {
* 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
*
* @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() {
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;
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() {
}
*/
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;
/**
* @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() {
- @Nullable
- public DatastoreContext getDatastoreContext() {
+ public @Nullable DatastoreContext getDatastoreContext() {
return datastoreContext;
}
return datastoreContext;
}
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;
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,
*/
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;
/**
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() {
- @Nonnull
- public DataTree getLocalShardDataTree() {
+ public @NonNull DataTree getLocalShardDataTree() {
return localShardDataTree;
}
return localShardDataTree;
}
*/
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;
/**
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;
}
/**
* 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;
}
* 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);
}
}
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;
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;
*/
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.
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;
}
}
* 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;
*
* @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() {
* 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;
/**
*
* @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() {
*/
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;
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;
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;
@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);
return Verify.verifyNotNull(externalizableProxy(serialized));
}
return Verify.verifyNotNull(externalizableProxy(serialized));
}
@SuppressWarnings("checkstyle:hiddenField")
@SuppressWarnings("checkstyle:hiddenField")
- protected abstract AbstractProxy<T> externalizableProxy(@Nonnull byte[] serialized);
+ protected abstract @NonNull AbstractProxy<T> externalizableProxy(byte @NonNull[] serialized);
*/
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}.
@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);
}
*
* @return Closest supported {@link PayloadVersion}
*/
*
* @return Closest supported {@link PayloadVersion}
*/
- @Nonnull
- public final PayloadVersion getClosestVersion() {
+ public final @NonNull PayloadVersion getClosestVersion() {
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;
*
* @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) {
*/
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;
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;
/**
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() {
- @Nullable
- public ShardManagerSnapshot getShardManagerSnapshot() {
+ public @Nullable ShardManagerSnapshot getShardManagerSnapshot() {
return shardManagerSnapshot;
}
return shardManagerSnapshot;
}
- @Nonnull
- public List<ShardSnapshot> getShardSnapshots() {
+ public @NonNull List<ShardSnapshot> getShardSnapshots() {
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() {
- @Nonnull
- public Snapshot getSnapshot() {
+ public @NonNull Snapshot getSnapshot() {
*/
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;
/**
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;
}
*
* @return Current {@link PayloadVersion}
*/
*
* @return Current {@link PayloadVersion}
*/
- @Nonnull
- public static PayloadVersion current() {
+ public static @NonNull PayloadVersion current() {
* @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:
* @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);
*/
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
}
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());
*
* @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();
}
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;
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);
*/
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;
/**
+ "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() {
*/
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;
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;
- 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;
}
- @Nullable
- ActorRef getActor() {
+ @Nullable ActorRef getActor() {
- 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();
- 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()));
}
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());
} 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());
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));
+ "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()));
* 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.
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);
}
* 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);
}
* 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;
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;
}
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;
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);
}
}
* 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}.
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) {
- 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);
}
}
* 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;
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;
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);
- 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()) {
}
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();
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");
@Override
public PathArgument getIdentifier() {
return identifier;
}
@Override
public PathArgument getIdentifier() {
return identifier;
}
@Override
public Collection<DataTreeCandidateNode> getChildNodes() {
return Collections.emptySet();
}
@Override
public Collection<DataTreeCandidateNode> getChildNodes() {
return Collections.emptySet();
}
@Override
@SuppressWarnings("checkstyle:hiddenField")
public DataTreeCandidateNode getModifiedChild(final PathArgument identifier) {
return null;
}
@Override
@SuppressWarnings("checkstyle:hiddenField")
public DataTreeCandidateNode getModifiedChild(final PathArgument identifier) {
return null;
}
@Override
public ModificationType getModificationType() {
return ModificationType.UNMODIFIED;
}
@Override
public ModificationType getModificationType() {
return ModificationType.UNMODIFIED;
}
@Override
public Optional<NormalizedNode<?, ?>> getDataAfter() {
return Optional.empty();
}
@Override
public Optional<NormalizedNode<?, ?>> getDataAfter() {
return Optional.empty();
}
@Override
public Optional<NormalizedNode<?, ?>> getDataBefore() {
return Optional.empty();
@Override
public Optional<NormalizedNode<?, ?>> getDataBefore() {
return Optional.empty();
* 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;
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 =
@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();
}
}
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));
}
@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) {
* 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;
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;
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;
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,
@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,
return ImmutableClassToInstanceMap.of();
}
return ImmutableClassToInstanceMap.of();
}
- 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);
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);
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);
}
return shardedDOMDataTree.createProducer(prefix);
}
return shardedDOMDataTree.createProducer(prefix);
}
@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);
this.shardTable = requireNonNull(shardLayout);
}
this.shardTable = requireNonNull(shardLayout);
}
@Override
public DOMDataTreeCursorAwareTransaction createTransaction(final boolean isolated) {
return delegate.createTransaction(isolated);
}
@Override
public DOMDataTreeCursorAwareTransaction createTransaction(final boolean isolated) {
return delegate.createTransaction(isolated);
}
@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);
- 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);
* 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
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);
- 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."
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;
- public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+ public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
changes.forEach(this::resolveChange);
}
changes.forEach(this::resolveChange);
}
* 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;
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();
@Override
public Collection<DOMDataTreeIdentifier> getPrefixes() {
return prefixes;
@Override
public Collection<DOMDataTreeIdentifier> getPrefixes() {
return prefixes;
}
void setModificationFactory(final DistributedShardModificationFactory modificationFactory) {
}
void setModificationFactory(final DistributedShardModificationFactory modificationFactory) {
- this.modificationFactory = Preconditions.checkNotNull(modificationFactory);
+ this.modificationFactory = requireNonNull(modificationFactory);
* 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;
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;
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() {
- 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();
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;
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);
}
- 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");
}
}
* 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;
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;
- public ShardStrategy getStrategyForPrefix(@Nonnull final DOMDataTreeIdentifier prefix) {
+ public ShardStrategy getStrategyForPrefix(final DOMDataTreeIdentifier prefix) {
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;
- 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);