import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
-import javax.annotation.Nullable;
import org.apache.aries.blueprint.NamespaceHandler;
import org.apache.aries.blueprint.services.BlueprintExtenderService;
import org.apache.aries.quiesce.participant.QuiesceParticipant;
import org.apache.aries.util.AriesFrameworkUtil;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.blueprint.ext.OpendaylightNamespaceHandler;
import org.opendaylight.yangtools.util.xml.UntrustedXML;
import org.osgi.framework.Bundle;
return bundlesToDestroy;
}
- @Nullable
- private Bundle findBundleWithHighestUsedServiceId(final Collection<Bundle> containerBundles) {
+ private @Nullable Bundle findBundleWithHighestUsedServiceId(final Collection<Bundle> containerBundles) {
ServiceReference<?> highestServiceRef = null;
for (Bundle bundle : containerBundles) {
ServiceReference<?>[] references = bundle.getRegisteredServices();
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
-import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
import org.apache.aries.blueprint.di.AbstractRecipe;
import org.apache.aries.blueprint.di.ExecutionContext;
import org.apache.aries.blueprint.di.Recipe;
import org.apache.aries.blueprint.ext.DependentComponentFactoryMetadata;
import org.apache.aries.blueprint.services.ExtendedBlueprintContainer;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.blueprint.BlueprintContainerRestartService;
import org.osgi.framework.ServiceReference;
import org.osgi.service.blueprint.container.ComponentDefinitionException;
}
@SuppressWarnings("unchecked")
- @Nullable
- protected <T> T getOSGiService(final Class<T> serviceInterface) {
+ protected <T> @Nullable T getOSGiService(final Class<T> serviceInterface) {
try {
ServiceReference<T> serviceReference =
container().getBundleContext().getServiceReference(serviceInterface);
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLStreamException;
import org.apache.aries.blueprint.services.ExtendedBlueprintContainer;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.blueprint.ext.DataStoreAppConfigDefaultXMLReader.ConfigURLProvider;
import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataBroker;
// project are still used - conversion to the mdsal binding classes hasn't occurred yet.
private volatile BindingNormalizedNodeSerializer bindingSerializer;
- public DataStoreAppConfigMetadata(@Nonnull final String id, @Nonnull final String appConfigBindingClassName,
- @Nullable final String appConfigListKeyValue, @Nullable final String defaultAppConfigFileName,
- @Nonnull final UpdateStrategy updateStrategyValue, @Nullable final Element defaultAppConfigElement) {
+ public DataStoreAppConfigMetadata(final String id, final @NonNull String appConfigBindingClassName,
+ final @Nullable String appConfigListKeyValue, final @Nullable String defaultAppConfigFileName,
+ final @NonNull UpdateStrategy updateStrategyValue, final @Nullable Element defaultAppConfigElement) {
super(id);
this.defaultAppConfigElement = defaultAppConfigElement;
this.defaultAppConfigFileName = defaultAppConfigFileName;
}
}
- @Nullable
- private NormalizedNode<?, ?> parsePossibleDefaultAppConfigElement(final SchemaContext schemaContext,
+ private @Nullable NormalizedNode<?, ?> parsePossibleDefaultAppConfigElement(final SchemaContext schemaContext,
final DataSchemaNode dataSchema) throws URISyntaxException, IOException, ParserConfigurationException,
SAXException, XMLStreamException {
if (defaultAppConfigElement == null) {
import java.util.Set;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
public final class HashedWheelTimerCloseable implements AutoCloseable, Timer {
return this.timer.stop();
}
- public static HashedWheelTimerCloseable newInstance(@Nullable final Long duration,
- @Nullable final Integer ticksPerWheel) {
+ public static HashedWheelTimerCloseable newInstance(final @Nullable Long duration,
+ final @Nullable Integer ticksPerWheel) {
return newInstance(null, duration, ticksPerWheel);
}
- public static HashedWheelTimerCloseable newInstance(@Nullable final ThreadFactory threadFactory,
- @Nullable final Long duration, @Nullable final Integer ticksPerWheel) {
+ public static HashedWheelTimerCloseable newInstance(final @Nullable ThreadFactory threadFactory,
+ final @Nullable Long duration, final @Nullable Integer ticksPerWheel) {
TimeUnit unit = TimeUnit.MILLISECONDS;
if(!nullOrNonPositive(duration) && threadFactory == null && nullOrNonPositive(ticksPerWheel)) {
return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit));
*/
package org.opendaylight.controller.cluster.access;
+import static com.google.common.base.Preconditions.checkArgument;
+
import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final short value;
ABIVersion(final int intVersion) {
- Preconditions.checkArgument(intVersion >= 0 && intVersion <= 65535);
+ checkArgument(intVersion >= 0 && intVersion <= 65535);
value = (short) intVersion;
}
*
* @return Current {@link ABIVersion}
*/
- @Nonnull
- public static ABIVersion current() {
+ public static @NonNull ABIVersion current() {
return BORON;
}
* @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 ABIVersion valueOf(final short value) throws FutureVersionException, PastVersionException {
+ public static @NonNull ABIVersion valueOf(final short value) throws FutureVersionException, PastVersionException {
switch (Short.toUnsignedInt(value)) {
case 0:
case 1:
* @return An {@link ABIVersion}
* @throws IOException If read fails or an unsupported version is encountered
*/
- @Nonnull
- public static ABIVersion readFrom(@Nonnull final DataInput in) throws IOException {
+ public static @NonNull ABIVersion readFrom(final @NonNull DataInput in) throws IOException {
final short s = in.readShort();
try {
return valueOf(s);
}
}
- public static ABIVersion inexactReadFrom(@Nonnull final DataInput in) throws IOException {
+ public static @NonNull ABIVersion inexactReadFrom(final @NonNull DataInput in) throws IOException {
final short onWire = in.readShort();
try {
return ABIVersion.valueOf(onWire);
*/
package org.opendaylight.controller.cluster.access;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Abstract base exception used for reporting version mismatches from {@link ABIVersion}.
@Beta
public abstract class AbstractVersionException extends Exception {
private static final long serialVersionUID = 1L;
- private final ABIVersion closestVersion;
+ private final @NonNull ABIVersion closestVersion;
private final int version;
AbstractVersionException(final String message, final short version, final ABIVersion closestVersion) {
super(message);
- this.closestVersion = Preconditions.checkNotNull(closestVersion);
+ this.closestVersion = requireNonNull(closestVersion);
this.version = Short.toUnsignedInt(version);
}
*
* @return Closest supported {@link ABIVersion}
*/
- @Nonnull
- public final ABIVersion getClosestVersion() {
+ public final @NonNull ABIVersion getClosestVersion() {
return closestVersion;
}
import akka.actor.ActorRef;
import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
public final class AbortLocalTransactionRequest extends AbstractLocalTransactionRequest<AbortLocalTransactionRequest> {
private static final long serialVersionUID = 1L;
- public AbortLocalTransactionRequest(@Nonnull final TransactionIdentifier identifier,
- @Nonnull final ActorRef replyTo) {
+ public AbortLocalTransactionRequest(final @NonNull TransactionIdentifier identifier,
+ final @NonNull ActorRef replyTo) {
super(identifier, 0, replyTo);
}
}
*/
package org.opendaylight.controller.cluster.access.commands;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public abstract class AbstractReadPathTransactionRequest<T extends AbstractReadPathTransactionRequest<T>>
extends AbstractReadTransactionRequest<T> {
private static final long serialVersionUID = 1L;
- private final YangInstanceIdentifier path;
+
+ private final @NonNull YangInstanceIdentifier path;
AbstractReadPathTransactionRequest(final TransactionIdentifier identifier, final long sequence,
final ActorRef replyTo, final YangInstanceIdentifier path, final boolean snapshotOnly) {
super(identifier, sequence, replyTo, snapshotOnly);
- this.path = Preconditions.checkNotNull(path);
+ this.path = requireNonNull(path);
}
AbstractReadPathTransactionRequest(final T request, final ABIVersion version) {
this.path = request.getPath();
}
- @Nonnull
- public final YangInstanceIdentifier getPath() {
+ public final @NonNull YangInstanceIdentifier getPath() {
return path;
}
*/
package org.opendaylight.controller.cluster.access.commands;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Optional;
-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.yangtools.yang.data.api.schema.tree.DataTreeModification;
private final Exception delayedFailure;
private final boolean coordinated;
- public CommitLocalTransactionRequest(@Nonnull final TransactionIdentifier identifier, final long sequence,
- @Nonnull final ActorRef replyTo, @Nonnull final DataTreeModification mod,
- @Nullable final Exception delayedFailure, final boolean coordinated) {
+ public CommitLocalTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence,
+ final @NonNull ActorRef replyTo, final @NonNull DataTreeModification mod,
+ final @Nullable Exception delayedFailure, final boolean coordinated) {
super(identifier, sequence, replyTo);
- this.mod = Preconditions.checkNotNull(mod);
+ this.mod = requireNonNull(mod);
this.delayedFailure = delayedFailure;
this.coordinated = coordinated;
}
*/
package org.opendaylight.controller.cluster.access.commands;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.AbstractRequestProxy;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
ConnectClientRequest(final ClientIdentifier identifier, final long txSequence, final ActorRef replyTo,
final ABIVersion minVersion, final ABIVersion maxVersion) {
super(identifier, txSequence, replyTo);
- this.minVersion = Preconditions.checkNotNull(minVersion);
- this.maxVersion = Preconditions.checkNotNull(maxVersion);
+ this.minVersion = requireNonNull(minVersion);
+ this.maxVersion = requireNonNull(maxVersion);
}
public ConnectClientRequest(final ClientIdentifier identifier, final ActorRef replyTo, final ABIVersion minVersion,
}
@Override
- @Nonnull
- protected ToStringHelper addToStringAttributes(@Nonnull final ToStringHelper toStringHelper) {
+ protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
return super.addToStringAttributes(toStringHelper).add("minVersion", minVersion).add("maxVersion", maxVersion);
}
}
*/
package org.opendaylight.controller.cluster.access.commands;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.List;
import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import org.opendaylight.controller.cluster.access.concepts.RequestSuccess;
@SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
+ "implements writeReplace to delegate serialization to a Proxy class and thus instances of this class "
+ "aren't serialized. FindBugs does not recognize this.")
- private final List<ActorSelection> alternates;
+ private final @NonNull List<ActorSelection> alternates;
@SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "See justification above.")
private final DataTree dataTree;
- private final ActorRef backend;
+ private final @NonNull ActorRef backend;
private final int maxMessages;
ConnectClientSuccess(final ClientIdentifier target, final long sequence, final ActorRef backend,
final List<ActorSelection> alternates, final Optional<DataTree> dataTree, final int maxMessages) {
super(target, sequence);
- this.backend = Preconditions.checkNotNull(backend);
+ this.backend = requireNonNull(backend);
this.alternates = ImmutableList.copyOf(alternates);
this.dataTree = dataTree.orElse(null);
- Preconditions.checkArgument(maxMessages > 0, "Maximum messages has to be positive, not %s", maxMessages);
+ checkArgument(maxMessages > 0, "Maximum messages has to be positive, not %s", maxMessages);
this.maxMessages = maxMessages;
}
- public ConnectClientSuccess(@Nonnull final ClientIdentifier target, final long sequence,
- @Nonnull final ActorRef backend, @Nonnull final List<ActorSelection> alternates,
- @Nonnull final DataTree dataTree, final int maxMessages) {
+ public ConnectClientSuccess(final @NonNull ClientIdentifier target, final long sequence,
+ final @NonNull ActorRef backend, final @NonNull List<ActorSelection> alternates,
+ final @NonNull DataTree dataTree, final int maxMessages) {
this(target, sequence, backend, alternates, Optional.of(dataTree), maxMessages);
}
*
* @return a list of known backend alternates
*/
- @Nonnull
- public List<ActorSelection> getAlternates() {
+ public @NonNull List<ActorSelection> getAlternates() {
return alternates;
}
- @Nonnull
- public ActorRef getBackend() {
+ public @NonNull ActorRef getBackend() {
return backend;
}
import akka.actor.ActorRef;
import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public final class ExistsTransactionRequest extends AbstractReadPathTransactionRequest<ExistsTransactionRequest> {
private static final long serialVersionUID = 1L;
- public ExistsTransactionRequest(@Nonnull final TransactionIdentifier identifier, final long sequence,
- @Nonnull final ActorRef replyTo, @Nonnull final YangInstanceIdentifier path, final boolean snapshotOnly) {
+ public ExistsTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence,
+ final @NonNull ActorRef replyTo, final @NonNull YangInstanceIdentifier path, final boolean snapshotOnly) {
super(identifier, sequence, replyTo, path, snapshotOnly);
}
import akka.actor.ActorRef;
import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public final class ReadTransactionRequest extends AbstractReadPathTransactionRequest<ReadTransactionRequest> {
private static final long serialVersionUID = 1L;
- public ReadTransactionRequest(@Nonnull final TransactionIdentifier identifier, final long sequence,
- @Nonnull final ActorRef replyTo, @Nonnull final YangInstanceIdentifier path, final boolean snapshotOnly) {
+ public ReadTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence,
+ final @NonNull ActorRef replyTo, final @NonNull YangInstanceIdentifier path, final boolean snapshotOnly) {
super(identifier, sequence, replyTo, path, snapshotOnly);
}
*/
package org.opendaylight.controller.cluster.access.concepts;
-import com.google.common.base.Verify;
+import static com.google.common.base.Verify.verifyNotNull;
+
import java.io.DataInput;
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.yangtools.concepts.WritableIdentifier;
import org.opendaylight.yangtools.concepts.WritableObjects;
// For Externalizable
}
- AbstractMessageProxy(@Nonnull final C message) {
+ AbstractMessageProxy(final @NonNull C message) {
this.target = message.getTarget();
this.sequence = message.getSequence();
}
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
- target = Verify.verifyNotNull(readTarget(in));
+ target = verifyNotNull(readTarget(in));
sequence = WritableObjects.readLong(in);
}
protected final Object readResolve() {
- return Verify.verifyNotNull(createMessage(target, sequence));
+ return verifyNotNull(createMessage(target, sequence));
}
- @Nonnull
- protected abstract T readTarget(@Nonnull DataInput in) throws IOException;
+ protected abstract @NonNull T readTarget(@NonNull DataInput in) throws IOException;
- @Nonnull
- abstract C createMessage(@Nonnull T msgTarget, long msgSequence);
+ abstract @NonNull C createMessage(@NonNull T msgTarget, long msgSequence);
}
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.yangtools.concepts.WritableIdentifier;
/**
// For Externalizable
}
- protected AbstractRequestFailureProxy(@Nonnull final C failure) {
+ protected AbstractRequestFailureProxy(final @NonNull C failure) {
super(failure);
this.cause = failure.getCause();
}
return createFailure(target, sequence, cause);
}
- @Nonnull
- protected abstract C createFailure(@Nonnull T target, long sequence, @Nonnull RequestException failureCause);
+ protected abstract @NonNull C createFailure(@NonNull T target, long sequence,
+ @NonNull RequestException failureCause);
}
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.yangtools.concepts.WritableIdentifier;
/**
// For Externalizable
}
- protected AbstractRequestProxy(@Nonnull final C request) {
+ protected AbstractRequestProxy(final @NonNull C request) {
super(request);
this.replyTo = request.getReplyTo();
}
}
@Override
- @Nonnull
- final C createMessage(@Nonnull final T target, final long sequence) {
+ final C createMessage(final T target, final long sequence) {
return createRequest(target, sequence, replyTo);
}
- @Nonnull
- protected abstract C createRequest(@Nonnull T target, long sequence, @Nonnull ActorRef replyToActor);
+ protected abstract @NonNull C createRequest(@NonNull T target, long sequence, @NonNull ActorRef replyToActor);
}
*/
package org.opendaylight.controller.cluster.access.concepts;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
// for Externalizable
}
- AbstractResponseProxy(@Nonnull final C response) {
+ AbstractResponseProxy(final @NonNull C response) {
super(response);
}
return createResponse(target, sequence);
}
- @Nonnull
- abstract C createResponse(@Nonnull T target, long sequence);
+ abstract @NonNull C createResponse(@NonNull T target, long sequence);
}
package org.opendaylight.controller.cluster.access.concepts;
import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
// For Externalizable
}
- protected AbstractSuccessProxy(@Nonnull final C success) {
+ protected AbstractSuccessProxy(final @NonNull C success) {
super(success);
}
return createSuccess(target, sequence);
}
- @Nonnull
- protected abstract C createSuccess(@Nonnull T target, long sequence);
+ protected abstract @NonNull C createSuccess(@NonNull T target, long sequence);
}
*/
package org.opendaylight.controller.cluster.access.concepts;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Verify.verifyNotNull;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
-import com.google.common.base.Verify;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.ObjectOutput;
import java.nio.charset.StandardCharsets;
import java.util.regex.Pattern;
-import javax.annotation.RegEx;
import org.opendaylight.yangtools.concepts.Identifier;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
}
Proxy(final byte[] serialized) {
- this.serialized = Preconditions.checkNotNull(serialized);
+ this.serialized = requireNonNull(serialized);
}
@Override
}
}
- @RegEx
private static final String SIMPLE_STRING_REGEX = "^[a-zA-Z0-9-_.*+:=,!~';]+$";
private static final Pattern SIMPLE_STRING_PATTERN = Pattern.compile(SIMPLE_STRING_REGEX);
private static final long serialVersionUID = 1L;
private volatile byte[] serialized;
private FrontendType(final String name) {
- this.name = Preconditions.checkNotNull(name);
+ this.name = requireNonNull(name);
}
FrontendType(final String name, final byte[] serialized) {
this(name);
- this.serialized = Verify.verifyNotNull(serialized);
+ this.serialized = verifyNotNull(serialized);
}
/**
* @throws IllegalArgumentException if the string is null, empty or contains invalid characters
*/
public static FrontendType forName(final String name) {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(name));
- Preconditions.checkArgument(SIMPLE_STRING_PATTERN.matcher(name).matches(),
+ checkArgument(!Strings.isNullOrEmpty(name));
+ checkArgument(SIMPLE_STRING_PATTERN.matcher(name).matches(),
"Supplied name %s does not patch pattern %s", name, SIMPLE_STRING_REGEX);
return new FrontendType(name);
}
*/
package org.opendaylight.controller.cluster.access.concepts;
+import static com.google.common.base.Verify.verifyNotNull;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
Serializable {
private static final long serialVersionUID = 1L;
- private final ABIVersion version;
+ private final @NonNull ABIVersion version;
private final long sequence;
- private final T target;
+ private final @NonNull T target;
private Message(final ABIVersion version, final T target, final long sequence) {
- this.target = Preconditions.checkNotNull(target);
- this.version = Preconditions.checkNotNull(version);
+ this.target = requireNonNull(target);
+ this.version = requireNonNull(version);
this.sequence = sequence;
}
*
* @return Target identifier
*/
- @Nonnull
- public final T getTarget() {
+ public final @NonNull T getTarget() {
return target;
}
}
@VisibleForTesting
- @Nonnull
- public final ABIVersion getVersion() {
+ public final @NonNull ABIVersion getVersion() {
return version;
}
* @return A new message which will use ABIVersion as its serialization.
*/
@SuppressWarnings("unchecked")
- @Nonnull
- public final C toVersion(@Nonnull final ABIVersion toVersion) {
+ public final @NonNull C toVersion(final @NonNull ABIVersion toVersion) {
if (this.version == toVersion) {
return (C)this;
}
switch (toVersion) {
case BORON:
- return Verify.verifyNotNull(cloneAsVersion(toVersion));
+ return verifyNotNull(cloneAsVersion(toVersion));
case TEST_PAST_VERSION:
case TEST_FUTURE_VERSION:
default:
* @return A message with the specified serialization stream
* @throws IllegalArgumentException if this message does not support the target ABI
*/
- @Nonnull
- protected abstract C cloneAsVersion(@Nonnull ABIVersion targetVersion);
+ protected abstract @NonNull C cloneAsVersion(@NonNull ABIVersion targetVersion);
@Override
public final String toString() {
* @return The {@link ToStringHelper} passed in as argument
* @throws NullPointerException if toStringHelper is null
*/
- @Nonnull
- protected ToStringHelper addToStringAttributes(@Nonnull final ToStringHelper toStringHelper) {
+ protected @NonNull ToStringHelper addToStringAttributes(final @NonNull ToStringHelper toStringHelper) {
return toStringHelper.add("target", target).add("sequence", Long.toUnsignedString(sequence));
}
* @param reqVersion Requested ABI version
* @return Proxy for this object
*/
- @Nonnull
- abstract AbstractMessageProxy<T, C> externalizableProxy(@Nonnull ABIVersion reqVersion);
+ abstract @NonNull AbstractMessageProxy<T, C> externalizableProxy(@NonNull ABIVersion reqVersion);
protected final Object writeReplace() {
return externalizableProxy(version);
*/
package org.opendaylight.controller.cluster.access.concepts;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
@Beta
public abstract class Request<T extends WritableIdentifier, C extends Request<T, C>> extends Message<T, C> {
private static final long serialVersionUID = 1L;
- private final ActorRef replyTo;
+ private final @NonNull ActorRef replyTo;
- protected Request(@Nonnull final T target, final long sequence, @Nonnull final ActorRef replyTo) {
+ protected Request(final @NonNull T target, final long sequence, final @NonNull ActorRef replyTo) {
super(target, sequence);
- this.replyTo = Preconditions.checkNotNull(replyTo);
+ this.replyTo = requireNonNull(replyTo);
}
- protected Request(@Nonnull final C request, @Nonnull final ABIVersion version) {
+ protected Request(final @NonNull C request, final @NonNull ABIVersion version) {
super(request, version);
- this.replyTo = Preconditions.checkNotNull(request.getReplyTo());
+ this.replyTo = requireNonNull(request.getReplyTo());
}
/**
*
* @return Original requestor
*/
- @Nonnull
- public final ActorRef getReplyTo() {
+ public final @NonNull ActorRef getReplyTo() {
return replyTo;
}
* @param cause Failure cause
* @return {@link RequestFailure} corresponding to this request
*/
- @Nonnull
- public abstract RequestFailure<T, ?> toRequestFailure(@Nonnull RequestException cause);
+ public abstract @NonNull RequestFailure<T, ?> toRequestFailure(@NonNull RequestException cause);
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
}
@Override
- protected abstract AbstractRequestProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+ protected abstract AbstractRequestProxy<T, C> externalizableProxy(ABIVersion version);
}
*/
package org.opendaylight.controller.cluster.access.concepts;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* A failure cause behind a {@link RequestFailure} to process a {@link Request}.
public abstract class RequestException extends Exception {
private static final long serialVersionUID = 1L;
- protected RequestException(@Nonnull final String message) {
- super(Preconditions.checkNotNull(message));
+ protected RequestException(final @NonNull String message) {
+ super(requireNonNull(message));
}
- protected RequestException(@Nonnull final String message, @Nonnull final Throwable cause) {
- super(Preconditions.checkNotNull(message), Preconditions.checkNotNull(cause));
+ protected RequestException(final @NonNull String message, final @NonNull Throwable cause) {
+ super(requireNonNull(message), requireNonNull(cause));
}
public abstract boolean isRetriable();
*/
package org.opendaylight.controller.cluster.access.concepts;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
public abstract class RequestFailure<T extends WritableIdentifier, C extends RequestFailure<T, C>>
extends Response<T, C> {
private static final long serialVersionUID = 1L;
- private final RequestException cause;
- protected RequestFailure(@Nonnull final C failure, @Nonnull final ABIVersion version) {
+ private final @NonNull RequestException cause;
+
+ protected RequestFailure(final @NonNull C failure, final @NonNull ABIVersion version) {
super(failure, version);
- this.cause = Preconditions.checkNotNull(failure.getCause());
+ this.cause = requireNonNull(failure.getCause());
}
- protected RequestFailure(@Nonnull final T target, final long sequence, @Nonnull final RequestException cause) {
+ protected RequestFailure(final @NonNull T target, final long sequence, final @NonNull RequestException cause) {
super(target, sequence);
- this.cause = Preconditions.checkNotNull(cause);
+ this.cause = requireNonNull(cause);
}
/**
*
* @return Failure cause.
*/
- @Nonnull
- public final RequestException getCause() {
+ public final @NonNull RequestException getCause() {
return cause;
}
}
@Override
- protected abstract AbstractRequestFailureProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+ protected abstract AbstractRequestFailureProxy<T, C> externalizableProxy(ABIVersion version);
}
package org.opendaylight.controller.cluster.access.concepts;
import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
Response<T, C> {
private static final long serialVersionUID = 1L;
- protected RequestSuccess(@Nonnull final C success, @Nonnull final ABIVersion version) {
+ protected RequestSuccess(final @NonNull C success, final @NonNull ABIVersion version) {
super(success, version);
}
- protected RequestSuccess(@Nonnull final T target, final long sequence) {
+ protected RequestSuccess(final @NonNull T target, final long sequence) {
super(target, sequence);
}
@Override
- protected abstract AbstractSuccessProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+ protected abstract AbstractSuccessProxy<T, C> externalizableProxy(ABIVersion version);
}
package org.opendaylight.controller.cluster.access.concepts;
import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
public abstract class Response<T extends WritableIdentifier, C extends Response<T, C>> extends Message<T, C> {
private static final long serialVersionUID = 1L;
- Response(@Nonnull final T target, final long sequence) {
+ Response(final @NonNull T target, final long sequence) {
super(target, sequence);
}
- Response(@Nonnull final C response, @Nonnull final ABIVersion version) {
+ Response(final @NonNull C response, final @NonNull ABIVersion version) {
super(response, version);
}
@Override
- abstract AbstractResponseProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+ abstract AbstractResponseProxy<T, C> externalizableProxy(ABIVersion version);
}
*/
package org.opendaylight.controller.cluster.access.concepts;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
import java.io.DataInput;
import java.io.DataOutput;
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.yangtools.concepts.WritableIdentifier;
import org.opendaylight.yangtools.concepts.WritableObjects;
}
Proxy(final LocalHistoryIdentifier historyId, final long transactionId) {
- this.historyId = Preconditions.checkNotNull(historyId);
+ this.historyId = requireNonNull(historyId);
this.transactionId = transactionId;
}
private final long transactionId;
private String shortString;
- public TransactionIdentifier(@Nonnull final LocalHistoryIdentifier historyId, final long transactionId) {
- this.historyId = Preconditions.checkNotNull(historyId);
+ public TransactionIdentifier(final @NonNull LocalHistoryIdentifier historyId, final long transactionId) {
+ this.historyId = requireNonNull(historyId);
this.transactionId = transactionId;
}
*/
package org.opendaylight.controller.cluster.access.concepts;
+import static org.junit.Assert.assertEquals;
+
import java.io.DataInput;
import java.io.IOException;
-import javax.annotation.Nonnull;
-import org.junit.Assert;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
@Override
protected void doAdditionalAssertions(final FailureEnvelope envelope, final FailureEnvelope resolvedObject) {
- Assert.assertEquals(envelope.getExecutionTimeNanos(), resolvedObject.getExecutionTimeNanos());
+ assertEquals(envelope.getExecutionTimeNanos(), resolvedObject.getExecutionTimeNanos());
final RequestException expectedCause = envelope.getMessage().getCause();
final RequestException actualCause = resolvedObject.getMessage().getCause();
- Assert.assertEquals(expectedCause.getMessage(), actualCause.getMessage());
- Assert.assertEquals(expectedCause.isRetriable(), actualCause.isRetriable());
+ assertEquals(expectedCause.getMessage(), actualCause.getMessage());
+ assertEquals(expectedCause.isRetriable(), actualCause.isRetriable());
}
private static class MockRequestFailureProxy extends AbstractRequestFailureProxy<WritableIdentifier, MockFailure> {
super(mockFailure);
}
- @Nonnull
@Override
- protected MockFailure createFailure(@Nonnull final WritableIdentifier target, final long sequence,
- @Nonnull final RequestException failureCause) {
+ protected MockFailure createFailure(final WritableIdentifier target, final long sequence,
+ final RequestException failureCause) {
return new MockFailure(target, failureCause, sequence);
}
- @Nonnull
@Override
- protected WritableIdentifier readTarget(@Nonnull final DataInput in) throws IOException {
+ protected WritableIdentifier readTarget(final DataInput in) throws IOException {
return TransactionIdentifier.readFrom(in);
}
protected MockFailure cloneAsVersion(final ABIVersion version) {
return this;
}
-
}
-
}
*/
package org.opendaylight.controller.cluster.access.client;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Base behavior attached to {@link AbstractClientActor}.
*/
@Beta
public abstract class AbstractClientActorBehavior<C extends AbstractClientActorContext> implements AutoCloseable {
- private final C context;
+ private final @NonNull C context;
- AbstractClientActorBehavior(@Nonnull final C context) {
+ AbstractClientActorBehavior(final @NonNull C context) {
// Hidden to prevent outside subclasses. Users instantiated this via ClientActorBehavior
- this.context = Preconditions.checkNotNull(context);
+ this.context = requireNonNull(context);
}
/**
*
* @return A client actor context instance.
*/
- @Nonnull
- protected final C context() {
+ protected final @NonNull C context() {
return context;
}
*
* @return Persistence identifier
*/
- @Nonnull
- protected final String persistenceId() {
+ protected final @NonNull String persistenceId() {
return context.persistenceId();
}
*
* @return Actor associated with this behavior
*/
- @Nonnull
- public final ActorRef self() {
+ public final @NonNull ActorRef self() {
return context.self();
}
* @param command Command message
* @return Behavior which should be used with the next message. Return null if this actor should shut down.
*/
- @Nullable
- abstract AbstractClientActorBehavior<?> onReceiveCommand(@Nonnull Object command);
+ abstract @Nullable AbstractClientActorBehavior<?> onReceiveCommand(@NonNull Object command);
/**
* Implementation-internal method for handling an incoming recovery message coming from persistence.
* @param recover Recover message
* @return Behavior which should be used with the next message. Return null if this actor should shut down.
*/
- @Nullable
- abstract AbstractClientActorBehavior<?> onReceiveRecover(@Nonnull Object recover);
+ abstract @Nullable AbstractClientActorBehavior<?> onReceiveRecover(@NonNull Object recover);
}
*/
package org.opendaylight.controller.cluster.access.client;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.Mutable;
/**
* @author Robert Varga
*/
abstract class AbstractClientActorContext implements Mutable {
- private final String persistenceId;
- private final ActorRef self;
+ private final @NonNull String persistenceId;
+ private final @NonNull ActorRef self;
- AbstractClientActorContext(@Nonnull final ActorRef self, @Nonnull final String persistenceId) {
- this.persistenceId = Preconditions.checkNotNull(persistenceId);
- this.self = Preconditions.checkNotNull(self);
+ AbstractClientActorContext(final @NonNull ActorRef self, final @NonNull String persistenceId) {
+ this.persistenceId = requireNonNull(persistenceId);
+ this.self = requireNonNull(self);
}
// TODO: rename this to logContext()
- @Nonnull
- final String persistenceId() {
+ final @NonNull String persistenceId() {
return persistenceId;
}
- @Nonnull
- public final ActorRef self() {
+ public final @NonNull ActorRef self() {
return self;
}
}
*/
package org.opendaylight.controller.cluster.access.client;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collection;
import java.util.Optional;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Consumer;
-import javax.annotation.Nonnull;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.concepts.Request;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
import org.opendaylight.controller.cluster.access.concepts.Response;
private final ClientActorContext context;
@GuardedBy("lock")
private final TransmitQueue queue;
- private final Long cookie;
+ private final @NonNull Long cookie;
private final String backendName;
@GuardedBy("lock")
// Private constructor to avoid code duplication.
private AbstractClientConnection(final AbstractClientConnection<T> oldConn, final TransmitQueue newQueue,
final String backendName) {
- this.context = Preconditions.checkNotNull(oldConn.context);
- this.cookie = Preconditions.checkNotNull(oldConn.cookie);
- this.backendName = Preconditions.checkNotNull(backendName);
- this.queue = Preconditions.checkNotNull(newQueue);
+ this.context = requireNonNull(oldConn.context);
+ this.cookie = requireNonNull(oldConn.cookie);
+ this.backendName = requireNonNull(backendName);
+ this.queue = requireNonNull(newQueue);
// Will be updated in finishReplay if needed.
this.lastReceivedTicks = oldConn.lastReceivedTicks;
}
// Do not allow subclassing outside of this package
AbstractClientConnection(final ClientActorContext context, final Long cookie, final String backendName,
final int queueDepth) {
- this.context = Preconditions.checkNotNull(context);
- this.cookie = Preconditions.checkNotNull(cookie);
- this.backendName = Preconditions.checkNotNull(backendName);
+ this.context = requireNonNull(context);
+ this.cookie = requireNonNull(cookie);
+ this.backendName = requireNonNull(backendName);
this.queue = new TransmitQueue.Halted(queueDepth);
this.lastReceivedTicks = currentTime();
}
AbstractClientConnection(final AbstractClientConnection<T> oldConn, final T newBackend,
final int queueDepth) {
this(oldConn, new TransmitQueue.Transmitting(oldConn.queue, queueDepth, newBackend, oldConn.currentTime(),
- Preconditions.checkNotNull(oldConn.context).messageSlicer()), newBackend.getName());
+ requireNonNull(oldConn.context).messageSlicer()), newBackend.getName());
}
public final ClientActorContext context() {
return context;
}
- public final @Nonnull Long cookie() {
+ public final @NonNull Long cookie() {
return cookie;
}
import akka.actor.ActorRef;
import java.util.concurrent.CompletionStage;
import java.util.function.Consumer;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.Registration;
/**
* @param cookie Backend cookie
* @return A {@link CompletionStage} resulting in information about the backend
*/
- @Nonnull
- public abstract CompletionStage<? extends T> getBackendInfo(@Nonnull Long cookie);
+ public abstract @NonNull CompletionStage<? extends T> getBackendInfo(@NonNull Long cookie);
/**
* Request re-resolution of a particular backend identified by a cookie, indicating a particular information as
* @param staleInfo Stale backend information
* @return A {@link CompletionStage} resulting in information about the backend
*/
- @Nonnull
- public abstract CompletionStage<? extends T> refreshBackendInfo(@Nonnull Long cookie, @Nonnull T staleInfo);
+ public abstract @NonNull CompletionStage<? extends T> refreshBackendInfo(@NonNull Long cookie,
+ @NonNull T staleInfo);
/**
* Registers a callback to be notified when BackendInfo that may have been previously obtained is now stale and
* @param callback the callback that takes the backend cookie whose BackendInfo is now stale.
* @return a Registration
*/
- @Nonnull
- public abstract Registration notifyWhenBackendInfoIsStale(Consumer<Long> callback);
+ public abstract @NonNull Registration notifyWhenBackendInfoIsStale(Consumer<Long> callback);
- @Nonnull
- public abstract String resolveCookieName(Long cookie);
+ public abstract @NonNull String resolveCookieName(Long cookie);
@Override
public void close() {
*/
package org.opendaylight.controller.cluster.access.client;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
import com.google.common.base.Verify;
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
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.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.access.commands.NotLeaderException;
import org.opendaylight.controller.cluster.access.commands.OutOfSequenceEnvelopeException;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
* @param enqueuedEntries Previously-enqueued entries
* @return A {@link ReconnectForwarder} to handle any straggler messages which arrive after this method returns.
*/
- @Nonnull ReconnectForwarder finishReconnect(@Nonnull Collection<ConnectionEntry> enqueuedEntries);
+ @NonNull ReconnectForwarder finishReconnect(@NonNull Collection<ConnectionEntry> enqueuedEntries);
}
private static final Logger LOG = LoggerFactory.getLogger(ClientActorBehavior.class);
private final MessageAssembler responseMessageAssembler;
private final Registration staleBackendInfoReg;
- protected ClientActorBehavior(@Nonnull final ClientActorContext context,
- @Nonnull final BackendInfoResolver<T> resolver) {
+ protected ClientActorBehavior(final @NonNull ClientActorContext context,
+ final @NonNull BackendInfoResolver<T> resolver) {
super(context);
- this.resolver = Preconditions.checkNotNull(resolver);
+ this.resolver = requireNonNull(resolver);
final ClientActorConfig config = context.config();
responseMessageAssembler = MessageAssembler.builder().logContext(persistenceId())
}
@Override
- @Nonnull
public final ClientIdentifier getIdentifier() {
return context().getIdentifier();
}
*
* @param cause Failure cause
*/
- protected abstract void haltClient(@Nonnull Throwable cause);
+ protected abstract void haltClient(@NonNull Throwable cause);
/**
* Override this method to handle any command which is not handled by the base behavior.
* @param command the command to process
* @return Next behavior to use, null if this actor should shut down.
*/
- @Nullable
- protected abstract ClientActorBehavior<T> onCommand(@Nonnull Object command);
+ protected abstract @Nullable ClientActorBehavior<T> onCommand(@NonNull Object command);
/**
* Override this method to provide a backend resolver instance.
*
* @return a backend resolver instance
*/
- protected final @Nonnull BackendInfoResolver<T> resolver() {
+ protected final @NonNull BackendInfoResolver<T> resolver() {
return resolver;
}
* @return ConnectionConnectCohort which will be used to complete the process of bringing the connection up.
*/
@GuardedBy("connectionsLock")
- @Nonnull protected abstract ConnectionConnectCohort connectionUp(@Nonnull ConnectedClientConnection<T> newConn);
+ protected abstract @NonNull ConnectionConnectCohort connectionUp(@NonNull ConnectedClientConnection<T> newConn);
private void backendConnectFinished(final Long shard, final AbstractClientConnection<T> oldConn,
final T backend, final Throwable failure) {
*/
package org.opendaylight.controller.cluster.access.client;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Cancellable;
import akka.actor.Scheduler;
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
import com.google.common.base.Ticker;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
import javax.annotation.concurrent.ThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
import org.opendaylight.controller.cluster.common.actor.Dispatchers;
import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
ClientActorContext(final ActorRef self, final String persistenceId, final ActorSystem system,
final ClientIdentifier identifier, final ClientActorConfig config) {
super(self, persistenceId);
- this.identifier = Preconditions.checkNotNull(identifier);
- this.scheduler = Preconditions.checkNotNull(system).scheduler();
+ this.identifier = requireNonNull(identifier);
+ this.scheduler = requireNonNull(system).scheduler();
this.executionContext = system.dispatcher();
this.dispatchers = new Dispatchers(system.dispatchers());
- this.config = Preconditions.checkNotNull(config);
+ this.config = requireNonNull(config);
messageSlicer = MessageSlicer.builder().messageSliceSize(config.getMaximumMessageSliceSize())
.logContext(persistenceId).expireStateAfterInactivity(config.getRequestTimeout(), TimeUnit.NANOSECONDS)
}
@Override
- @Nonnull
public ClientIdentifier getIdentifier() {
return identifier;
}
- @Nonnull
- public ClientActorConfig config() {
+ public @NonNull ClientActorConfig config() {
return config;
}
- @Nonnull
- public Dispatchers dispatchers() {
+ public @NonNull Dispatchers dispatchers() {
return dispatchers;
}
- @Nonnull
- public MessageSlicer messageSlicer() {
+ public @NonNull MessageSlicer messageSlicer() {
return messageSlicer;
}
*
* @return Client actor time source
*/
- @Nonnull
- public Ticker ticker() {
+ public @NonNull Ticker ticker() {
return Ticker.systemTicker();
}
* @param command Block of code which needs to be execute
* @param <T> BackendInfo type
*/
- public <T extends BackendInfo> void executeInActor(@Nonnull final InternalCommand<T> command) {
- self().tell(Preconditions.checkNotNull(command), ActorRef.noSender());
+ public <T extends BackendInfo> void executeInActor(final @NonNull InternalCommand<T> command) {
+ self().tell(requireNonNull(command), ActorRef.noSender());
}
- public <T extends BackendInfo> Cancellable executeInActor(@Nonnull final InternalCommand<T> command,
+ public <T extends BackendInfo> Cancellable executeInActor(final @NonNull InternalCommand<T> command,
final FiniteDuration delay) {
- return scheduler.scheduleOnce(Preconditions.checkNotNull(delay), self(), Preconditions.checkNotNull(command),
+ return scheduler.scheduleOnce(requireNonNull(delay), self(), requireNonNull(command),
executionContext, ActorRef.noSender());
}
}
package org.opendaylight.controller.cluster.access.client;
import akka.dispatch.ControlMessage;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
/**
* This interface is used to pass the unit of work via the actors mailbox. The command can alter behavior of the actor
* @param currentBehavior Current Behavior
* @return Next behavior to use in the client actor
*/
- @Nullable ClientActorBehavior<T> execute(@Nonnull ClientActorBehavior<T> currentBehavior);
+ @Nullable ClientActorBehavior<T> execute(@NonNull ClientActorBehavior<T> currentBehavior);
}
*/
package org.opendaylight.controller.cluster.access.client;
-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.Response;
@FunctionalInterface
* @param response Response to the request
* @return Next client actor behavior
*/
- @Nullable ClientActorBehavior<?> complete(@Nonnull Response<?, ?> response);
+ @Nullable ClientActorBehavior<?> complete(@NonNull Response<?, ?> response);
}
package org.opendaylight.controller.cluster.dom.api;
import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.mdsal.dom.api.DOMDataTreeProducer;
* are violated, for example if this producer is bound and this thread
* is currently not executing from a listener context.
*/
- @Nonnull CDSShardAccess getShardAccess(@Nonnull DOMDataTreeIdentifier subtree);
+ @NonNull CDSShardAccess getShardAccess(@NonNull DOMDataTreeIdentifier subtree);
}
import com.google.common.annotations.Beta;
import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
/**
* @throws IllegalStateException if the {@link CDSDataTreeProducer} from which the associated
* {@link CDSDataTreeProducer} is no longer valid.
*/
- @Nonnull DOMDataTreeIdentifier getShardIdentifier();
+ @NonNull DOMDataTreeIdentifier getShardIdentifier();
/**
* Return the shard leader location relative to the local node.
* @throws IllegalStateException if the {@link CDSDataTreeProducer} from which the associated
* {@link CDSDataTreeProducer} is no longer valid.
*/
- @Nonnull LeaderLocation getLeaderLocation();
+ @NonNull LeaderLocation getLeaderLocation();
/**
* Request the shard leader to be moved to the local node. The request will be evaluated against shard state and
* @throws IllegalStateException if the {@link CDSDataTreeProducer} from which the associated
* {@link CDSDataTreeProducer} is no longer valid.
*/
- @Nonnull CompletionStage<Void> makeLeaderLocal();
+ @NonNull CompletionStage<Void> makeLeaderLocal();
/**
* Register a listener to shard location changes. Each listener object can be registered at most once.
* {@link CDSDataTreeProducer} is no longer valid.
* @throws NullPointerException if listener is null.
*/
- @Nonnull <L extends LeaderLocationListener> LeaderLocationListenerRegistration<L> registerLeaderLocationListener(
- @Nonnull L listener);
+ @NonNull <L extends LeaderLocationListener> LeaderLocationListenerRegistration<L> registerLeaderLocationListener(
+ @NonNull L listener);
}
import com.google.common.annotations.Beta;
import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Listener for shard leader location changes.
*
* @param location Current leader location as known by the local node.
*/
- void onLeaderLocationChanged(@Nonnull LeaderLocation location);
+ void onLeaderLocationChanged(@NonNull LeaderLocation location);
}
*/
package org.opendaylight.controller.md.sal.trace.closetracker.impl;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Convenience abstract base class for {@link CloseTracked} implementors.
*/
package org.opendaylight.controller.md.sal.trace.closetracker.impl;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Object which can track where something has been created, and if it has been correctly "closed".
*/
package org.opendaylight.controller.md.sal.trace.closetracker.impl;
+import static java.util.Objects.requireNonNull;
+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.util.Objects;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Implementation of {@link CloseTracked} which can be used as a field in
private final CloseTrackedRegistry<T> closeTrackedRegistry;
private final CloseTracked<T> realCloseTracked;
+ @SuppressFBWarnings(value = "NP_STORE_INTO_NONNULL_FIELD", justification = "SpotBugs and JDT annotations")
public CloseTrackedTrait(CloseTrackedRegistry<T> transactionChainRegistry, CloseTracked<T> realCloseTracked) {
if (transactionChainRegistry.isDebugContextEnabled()) {
// NB: We're NOT doing the (expensive) getStackTrace() here just yet (only below)
} else {
this.allocationContext = null;
}
- this.realCloseTracked = Objects.requireNonNull(realCloseTracked, "realCloseTracked");
- this.closeTrackedRegistry = Objects.requireNonNull(transactionChainRegistry, "transactionChainRegistry");
+ this.realCloseTracked = requireNonNull(realCloseTracked, "realCloseTracked");
+ this.closeTrackedRegistry = requireNonNull(transactionChainRegistry, "transactionChainRegistry");
this.closeTrackedRegistry.add(this);
}
@Override
- @Nullable
@SuppressFBWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS")
public StackTraceElement[] getAllocationContextStackTrace() {
return allocationContext != null ? allocationContext.getStackTrace() : null;
*/
package org.opendaylight.controller.md.sal.trace.dom.impl;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.FluentFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.Objects;
import java.util.Set;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.common.api.CommitInfo;
private final List<String> logs = new ArrayList<>();
AbstractTracingWriteTransaction(DOMDataWriteTransaction delegate, TracingBroker tracingBroker) {
- this.delegate = Objects.requireNonNull(delegate);
- this.tracingBroker = Objects.requireNonNull(tracingBroker);
+ this.delegate = requireNonNull(delegate);
+ this.tracingBroker = requireNonNull(tracingBroker);
recordOp(null, null, "instantiate", null);
}
}
@Override
- @Nonnull
public Object getIdentifier() {
return delegate.getIdentifier();
}
import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener;
return new TracingReadOnlyTransaction(delegate.newReadOnlyTransaction(), readOnlyTransactionsRegistry);
}
- @Nonnull
@Override
public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> res = delegate.getSupportedExtensions();
res = new HashMap<>(res);
res.put(DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
- @Nonnull
@Override
public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
- @Nonnull DOMDataTreeIdentifier domDataTreeIdentifier, @Nonnull L listener) {
+ DOMDataTreeIdentifier domDataTreeIdentifier, L listener) {
if (isRegistrationWatched(domDataTreeIdentifier.getRootIdentifier(),
domDataTreeIdentifier.getDatastoreType())) {
LOG.warn("{} registration (registerDataTreeChangeListener) for {} from {}.",
*/
package org.opendaylight.controller.messagebus.app.impl;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;
-import javax.annotation.Nonnull;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
private EventSourceTopic(final NotificationPattern notificationPattern, final String nodeIdRegexPattern,
final EventSourceService sourceService) {
- this.notificationPattern = Preconditions.checkNotNull(notificationPattern);
- this.sourceService = Preconditions.checkNotNull(sourceService);
+ this.notificationPattern = requireNonNull(notificationPattern);
+ this.sourceService = requireNonNull(sourceService);
this.nodeIdPattern = Pattern.compile(nodeIdRegexPattern);
this.topicId = new TopicId(getUUIDIdent());
this.listenerRegistration = null;
Futures.addCallback(future, new FutureCallback<Optional<Topology>>() {
@Override
- public void onSuccess(@Nonnull final Optional<Topology> data) {
+ public void onSuccess(final Optional<Topology> data) {
if (data.isPresent()) {
final List<Node> nodes = data.get().getNode();
if (nodes != null) {
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
-import javax.annotation.Nonnull;
import org.apache.commons.lang3.SerializationUtils;
import org.opendaylight.controller.cluster.example.messages.KeyValue;
import org.opendaylight.controller.cluster.example.messages.KeyValueSaved;
}
private final Map<String, String> state = new HashMap<>();
-
- private long persistIdentifier = 1;
private final Optional<ActorRef> roleChangeNotifier;
+ private long persistIdentifier = 1;
public ExampleActor(String id, Map<String, String> peerAddresses,
Optional<ConfigParams> configParams) {
}
}
- @Override protected void onStateChanged() {
+ @Override
+ protected void onStateChanged() {
}
- @Override public String persistenceId() {
+ @Override
+ public String persistenceId() {
return getId();
}
@Override
- @Nonnull
protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
return this;
}
*/
package org.opendaylight.controller.cluster.raft;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
import scala.concurrent.duration.FiniteDuration;
*
* @return an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy.
*/
- @Nonnull
- RaftPolicy getRaftPolicy();
+ @NonNull RaftPolicy getRaftPolicy();
/**
* Returns the PeerAddressResolver.
*
* @return the PeerAddressResolver instance.
*/
- @Nonnull
- PeerAddressResolver getPeerAddressResolver();
+ @NonNull PeerAddressResolver getPeerAddressResolver();
/**
* Returns the custom RaftPolicy class name.
*
* @return the directory in which to create temp files.
*/
- @Nonnull
- String getTempFileDirectory();
+ @NonNull String getTempFileDirectory();
/**
* Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in
*/
package org.opendaylight.controller.cluster.raft;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.Strings;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.raft.policy.DefaultRaftPolicy;
import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
import org.slf4j.Logger;
return peerAddressResolver;
}
- public void setPeerAddressResolver(@Nonnull final PeerAddressResolver peerAddressResolver) {
- this.peerAddressResolver = Preconditions.checkNotNull(peerAddressResolver);
+ public void setPeerAddressResolver(final @NonNull PeerAddressResolver peerAddressResolver) {
+ this.peerAddressResolver = requireNonNull(peerAddressResolver);
}
@Override
}
public void setSyncIndexThreshold(final long syncIndexThreshold) {
- Preconditions.checkArgument(syncIndexThreshold >= 0);
+ checkArgument(syncIndexThreshold >= 0);
this.syncIndexThreshold = syncIndexThreshold;
}
* 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.raft;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
/**
* ElectionTerm contains information about a RaftActors election term.
*
* @return candidate id that received the vote or null if no candidate was voted for.
*/
- @Nullable
- String getVotedFor();
+ @Nullable String getVotedFor();
/**
* This method updates the in-memory election term state. This method should be called when recovering election
* 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.raft;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
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.raft.behaviors.LeaderInstallSnapshotState;
/**
this.nextIndex = context.getCommitIndex();
this.matchIndex = matchIndex;
this.context = context;
- this.peerInfo = Preconditions.checkNotNull(peerInfo);
+ this.peerInfo = requireNonNull(peerInfo);
}
/**
*
* @return the LeaderInstallSnapshotState if a snapshot install is in progress, null otherwise.
*/
- @Nullable
- public LeaderInstallSnapshotState getInstallSnapshotState() {
+ public @Nullable LeaderInstallSnapshotState getInstallSnapshotState() {
return installSnapshotState;
}
*
* @param state the LeaderInstallSnapshotState
*/
- public void setLeaderInstallSnapshotState(@Nonnull final LeaderInstallSnapshotState state) {
+ public void setLeaderInstallSnapshotState(final @NonNull LeaderInstallSnapshotState state) {
if (this.installSnapshotState == null) {
- this.installSnapshotState = Preconditions.checkNotNull(state);
+ this.installSnapshotState = requireNonNull(state);
}
}
* Clears the LeaderInstallSnapshotState when an install snapshot is complete.
*/
public void clearLeaderInstallSnapshotState() {
- Preconditions.checkState(installSnapshotState != null);
+ checkState(installSnapshotState != null);
installSnapshotState.close();
installSnapshotState = null;
}
needsLeaderAddress = value;
}
- @Nullable
- public String needsLeaderAddress(String leaderId) {
+ public @Nullable String needsLeaderAddress(String leaderId) {
return needsLeaderAddress ? context.getPeerAddress(leaderId) : null;
}
*/
package org.opendaylight.controller.cluster.raft;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Interface to resolve raft actor peer addresses.
* @param address the peer's actor's address
*/
default void setResolved(String peerId, String address) {
+
}
}
* 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.raft;
+import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.PoisonPill;
import akka.actor.Status;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
import com.google.common.collect.Lists;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import org.apache.commons.lang3.time.DurationFormatUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.DataPersistenceProvider;
import org.opendaylight.controller.cluster.DelegatingPersistentDataProvider;
import org.opendaylight.controller.cluster.NonPersistentDataProvider;
}
private void initiateLeadershipTransfer(final RaftActorLeadershipTransferCohort.OnComplete onComplete,
- @Nullable final String followerId, final long newLeaderTimeoutInMillis) {
+ final @Nullable String followerId, final long newLeaderTimeoutInMillis) {
LOG.debug("{}: Initiating leader transfer", persistenceId());
RaftActorLeadershipTransferCohort leadershipTransferInProgress = context.getRaftActorLeadershipTransferCohort();
/**
* Returns the RaftActorRecoveryCohort to participate in persistence recovery.
*/
- @Nonnull
- protected abstract RaftActorRecoveryCohort getRaftActorRecoveryCohort();
+ protected abstract @NonNull RaftActorRecoveryCohort getRaftActorRecoveryCohort();
/**
* This method is called when recovery is complete.
/**
* Returns the RaftActorSnapshotCohort to participate in snapshot captures.
*/
- @Nonnull
- protected abstract RaftActorSnapshotCohort getRaftActorSnapshotCohort();
+ protected abstract @NonNull RaftActorSnapshotCohort getRaftActorSnapshotCohort();
/**
* This method will be called by the RaftActor when the state of the
@Nullable abstract String getLastLeaderId();
- @Nullable abstract short getLeaderPayloadVersion();
+ abstract short getLeaderPayloadVersion();
}
/**
final RaftActorBehavior behavior) {
this.lastValidLeaderId = lastValidLeaderId;
this.lastLeaderId = lastLeaderId;
- this.behavior = Preconditions.checkNotNull(behavior);
+ this.behavior = requireNonNull(behavior);
this.leaderPayloadVersion = behavior.getLeaderPayloadVersion();
}
BehaviorState capture(final RaftActorBehavior behavior) {
if (behavior == null) {
- Verify.verify(lastValidLeaderId == null, "Null behavior with non-null last leader");
+ verify(lastValidLeaderId == null, "Null behavior with non-null last leader");
return NULL_BEHAVIOR_STATE;
}
* 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.raft;
import akka.actor.ActorRef;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.LongSupplier;
-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.DataPersistenceProvider;
import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
*
* @return the ElectionTerm.
*/
- @Nonnull
- ElectionTerm getTermInformation();
+ @NonNull ElectionTerm getTermInformation();
/**
* Returns the index of highest log entry known to be committed.
*
* @param replicatedLog the ReplicatedLog instance.
*/
- void setReplicatedLog(@Nonnull ReplicatedLog replicatedLog);
+ void setReplicatedLog(@NonNull ReplicatedLog replicatedLog);
/**
* Returns the ReplicatedLog instance.
*
* @return the ReplicatedLog instance.
*/
- @Nonnull
- ReplicatedLog getReplicatedLog();
+ @NonNull ReplicatedLog getReplicatedLog();
/**
* Returns the The ActorSystem associated with this context.
*
* @return the ActorSystem.
*/
- @Nonnull
- ActorSystem getActorSystem();
+ @NonNull ActorSystem getActorSystem();
/**
* Returns the logger to be used for logging messages.
*
* @return the logger.
*/
- @Nonnull
- Logger getLogger();
+ @NonNull Logger getLogger();
/**
* Gets the address of a peer as a String. This is the same format in which a consumer would provide the address.
* @param peerId the id of the peer.
* @return the address of the peer or null if the address has not yet been resolved.
*/
- @Nullable
- String getPeerAddress(String peerId);
+ @Nullable String getPeerAddress(String peerId);
/**
* Updates the peers and information to match the given ServerConfigurationPayload.
*
* @return list of PeerInfo
*/
- @Nonnull
- Collection<PeerInfo> getPeers();
+ @NonNull Collection<PeerInfo> getPeers();
/**
* Returns the id's for each peer.
*
* @return the list of peer id's.
*/
- @Nonnull
- Collection<String> getPeerIds();
+ @NonNull Collection<String> getPeerIds();
/**
* Returns the PeerInfo for the given peer.
* @param peerId the id of the peer
* @return the PeerInfo or null if not found
*/
- @Nullable
- PeerInfo getPeerInfo(String peerId);
+ @Nullable PeerInfo getPeerInfo(String peerId);
/**
* Adds a new peer.
* @param peerId the id of the peer.
* @return the actorSelection corresponding to the peer or null if the address has not yet been resolved.
*/
- @Nullable
- ActorSelection getPeerActorSelection(String peerId);
+ @Nullable ActorSelection getPeerActorSelection(String peerId);
/**
* Sets the address of a peer.
*
* @return the ConfigParams instance.
*/
- @Nonnull
- ConfigParams getConfigParams();
+ @NonNull ConfigParams getConfigParams();
/**
* Returns the SnapshotManager instance.
*
* @return the SnapshotManager instance.
*/
- @Nonnull
- SnapshotManager getSnapshotManager();
+ @NonNull SnapshotManager getSnapshotManager();
/**
* Returns the DataPersistenceProvider instance.
*
* @return the DataPersistenceProvider instance.
*/
- @Nonnull
- DataPersistenceProvider getPersistenceProvider();
+ @NonNull DataPersistenceProvider getPersistenceProvider();
/**
* Determines if there are any peer followers.
*
* @return the RaftPolicy instance.
*/
- @Nonnull
- RaftPolicy getRaftPolicy();
+ @NonNull RaftPolicy getRaftPolicy();
/**
* Determines if there have been any dynamic server configuration changes applied.
* @return the peer information as a ServerConfigurationPayload or null if no dynamic server configurations have
* been applied.
*/
- @Nullable
- ServerConfigurationPayload getPeerServerInfo(boolean includeSelf);
+ @Nullable ServerConfigurationPayload getPeerServerInfo(boolean includeSelf);
/**
* Determines if this peer is a voting member of the cluster.
*
* @return the {@link FileBackedOutputStreamFactory};
*/
- @Nonnull
- FileBackedOutputStreamFactory getFileBackedOutputStreamFactory();
+ @NonNull FileBackedOutputStreamFactory getFileBackedOutputStreamFactory();
/**
* Returns the RaftActorLeadershipTransferCohort if leadership transfer is in progress.
*
* @return the RaftActorLeadershipTransferCohort if leadership transfer is in progress, null otherwise
*/
- @Nullable
- RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort();
+ @Nullable RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort();
/**
* Sets the RaftActorLeadershipTransferCohort for transferring leadership.
* 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.raft;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorContext;
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.Props;
import akka.cluster.Cluster;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.LongSupplier;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.DataPersistenceProvider;
import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
private RaftActorLeadershipTransferCohort leadershipTransferCohort;
public RaftActorContextImpl(final ActorRef actor, final ActorContext context, final String id,
- @Nonnull final ElectionTerm termInformation, final long commitIndex, final long lastApplied,
- @Nonnull final Map<String, String> peerAddresses,
- @Nonnull final ConfigParams configParams, @Nonnull final DataPersistenceProvider persistenceProvider,
- @Nonnull final Consumer<ApplyState> applyStateConsumer, @Nonnull final Logger logger) {
+ final @NonNull ElectionTerm termInformation, final long commitIndex, final long lastApplied,
+ final @NonNull Map<String, String> peerAddresses,
+ final @NonNull ConfigParams configParams, final @NonNull DataPersistenceProvider persistenceProvider,
+ final @NonNull Consumer<ApplyState> applyStateConsumer, final @NonNull Logger logger) {
this.actor = actor;
this.context = context;
this.id = id;
- this.termInformation = Preconditions.checkNotNull(termInformation);
+ this.termInformation = requireNonNull(termInformation);
this.commitIndex = commitIndex;
this.lastApplied = lastApplied;
- this.configParams = Preconditions.checkNotNull(configParams);
- this.persistenceProvider = Preconditions.checkNotNull(persistenceProvider);
- this.log = Preconditions.checkNotNull(logger);
- this.applyStateConsumer = Preconditions.checkNotNull(applyStateConsumer);
+ this.configParams = requireNonNull(configParams);
+ this.persistenceProvider = requireNonNull(persistenceProvider);
+ this.log = requireNonNull(logger);
+ this.applyStateConsumer = requireNonNull(applyStateConsumer);
fileBackedOutputStreamFactory = new FileBackedOutputStreamFactory(
configParams.getFileBackedStreamingThreshold(), configParams.getTempFileDirectory());
- for (Map.Entry<String, String> e: Preconditions.checkNotNull(peerAddresses).entrySet()) {
+ for (Map.Entry<String, String> e : requireNonNull(peerAddresses).entrySet()) {
peerInfoMap.put(e.getKey(), new PeerInfo(e.getKey(), e.getValue(), VotingState.VOTING));
}
}
}
void setCurrentBehavior(final RaftActorBehavior behavior) {
- this.currentBehavior = Preconditions.checkNotNull(behavior);
+ this.currentBehavior = requireNonNull(behavior);
}
@Override
}
@Override
- @Nullable
public RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort() {
return leadershipTransferCohort;
}
@Override
@SuppressWarnings("checkstyle:hiddenField")
- public void setRaftActorLeadershipTransferCohort(
- @Nullable final RaftActorLeadershipTransferCohort leadershipTransferCohort) {
+ public void setRaftActorLeadershipTransferCohort(final RaftActorLeadershipTransferCohort leadershipTransferCohort) {
this.leadershipTransferCohort = leadershipTransferCohort;
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.raft.base.messages.LeaderTransitioning;
import org.opendaylight.controller.cluster.raft.behaviors.Leader;
import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior;
this(raftActor, null);
}
- RaftActorLeadershipTransferCohort(final RaftActor raftActor, @Nullable final String requestedFollowerId) {
+ RaftActorLeadershipTransferCohort(final RaftActor raftActor, final @Nullable String requestedFollowerId) {
this.raftActor = raftActor;
this.requestedFollowerId = requestedFollowerId;
*/
package org.opendaylight.controller.cluster.raft;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
*
* @return the snapshot or null if there's no snapshot to restore
*/
- @Nullable
- Snapshot getRestoreFromSnapshot();
+ @Nullable Snapshot getRestoreFromSnapshot();
}
*/
package org.opendaylight.controller.cluster.raft;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.Cancellable;
-import com.google.common.base.Preconditions;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.Queue;
import java.util.UUID;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
import org.opendaylight.controller.cluster.raft.base.messages.SnapshotComplete;
import org.opendaylight.controller.cluster.raft.base.messages.TimeoutNow;
}
protected void operationComplete(final ServerOperationContext<?> operationContext,
- @Nullable final ServerChangeStatus replyStatus) {
+ final @Nullable ServerChangeStatus replyStatus) {
if (replyStatus != null) {
sendReply(operationContext, replyStatus);
}
InstallingSnapshot(final AddServerContext addServerContext, final Cancellable installSnapshotTimer) {
super(addServerContext);
- this.installSnapshotTimer = Preconditions.checkNotNull(installSnapshotTimer);
+ this.installSnapshotTimer = requireNonNull(installSnapshotTimer);
}
@Override
WaitingForPriorSnapshotComplete(final AddServerContext addServerContext, final Cancellable snapshotTimer) {
super(addServerContext);
- this.snapshotTimer = Preconditions.checkNotNull(snapshotTimer);
+ this.snapshotTimer = requireNonNull(snapshotTimer);
}
@Override
private final RemoveServerContext removeServerContext;
protected RemoveServerState(final RemoveServerContext removeServerContext) {
- this.removeServerContext = Preconditions.checkNotNull(removeServerContext);
+ this.removeServerContext = requireNonNull(removeServerContext);
}
private final String loggingContext;
ServerOperationTimeout(final String loggingContext) {
- this.loggingContext = Preconditions.checkNotNull(loggingContext, "loggingContext should not be null");
+ this.loggingContext = requireNonNull(loggingContext, "loggingContext should not be null");
}
String getLoggingContext() {
import java.io.IOException;
import java.io.OutputStream;
import java.util.Optional;
-import javax.annotation.Nonnull;
-import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.controller.cluster.raft.persisted.Snapshot.State;
/**
* Interface for a class that participates in raft actor snapshotting.
* serialized data back to a State instance on the follower end. The serialization for snapshot install is
* passed off so the cost of serialization is not charged to the raft actor's thread.
*/
- void createSnapshot(@Nonnull ActorRef actorRef, @Nonnull Optional<OutputStream> installSnapshotStream);
+ void createSnapshot(@NonNull ActorRef actorRef, @NonNull Optional<OutputStream> installSnapshotStream);
/**
* This method is called to apply a snapshot installed by the leader.
*
* @param snapshotState a snapshot of the state of the actor
*/
- void applySnapshot(@Nonnull Snapshot.State snapshotState);
+ void applySnapshot(@NonNull State snapshotState);
/**
* This method is called to de-serialize snapshot data that was previously serialized via {@link #createSnapshot}
* @return the converted snapshot State
* @throws IOException if an error occurs accessing the ByteSource or de-serializing
*/
- @Nonnull
- Snapshot.State deserializeSnapshot(@Nonnull ByteSource snapshotBytes) throws IOException;
+ @NonNull State deserializeSnapshot(@NonNull ByteSource snapshotBytes) throws IOException;
}
* 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.raft;
import akka.japi.Procedure;
import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Represents the ReplicatedLog that needs to be kept in sync by the RaftActor.
* @return the ReplicatedLogEntry if found, otherwise null if the adjusted index less than 0 or
* greater than the size of the in-memory journal
*/
- @Nullable
- ReplicatedLogEntry get(long index);
+ @Nullable ReplicatedLogEntry get(long index);
/**
* Return the last replicated log entry in the log or null of not found.
*
* @return the last replicated log entry in the log or null of not found.
*/
- @Nullable
- ReplicatedLogEntry last();
+ @Nullable ReplicatedLogEntry last();
/**
* Return the index of the last entry in the log or -1 if the log is empty.
* delivered after persistence is complete and the associated callback is executed.
* @return true if the entry was successfully appended, false otherwise.
*/
- boolean appendAndPersist(@Nonnull ReplicatedLogEntry replicatedLogEntry,
+ boolean appendAndPersist(@NonNull ReplicatedLogEntry replicatedLogEntry,
@Nullable Procedure<ReplicatedLogEntry> callback, boolean doAsync);
/**
* @param index the index of the first log entry to get.
* @return the List of entries
*/
- @Nonnull List<ReplicatedLogEntry> getFrom(long index);
+ @NonNull List<ReplicatedLogEntry> getFrom(long index);
/**
* Returns a list of log entries starting from the given index up to the given maximum of entries or
* @param maxDataSize the maximum accumulated size of the log entries to get
* @return the List of entries meeting the criteria.
*/
- @Nonnull List<ReplicatedLogEntry> getFrom(long index, int maxEntries, long maxDataSize);
+ @NonNull List<ReplicatedLogEntry> getFrom(long index, int maxEntries, long maxDataSize);
/**
* Returns the number of entries in the journal.
*/
package org.opendaylight.controller.cluster.raft;
+import static java.util.Objects.requireNonNull;
+
import akka.japi.Procedure;
-import com.google.common.base.Preconditions;
import java.util.Collections;
import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import org.opendaylight.controller.cluster.raft.persisted.DeleteEntries;
import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
final List<ReplicatedLogEntry> unAppliedEntries,
final RaftActorContext context) {
super(snapshotIndex, snapshotTerm, unAppliedEntries, context.getId());
- this.context = Preconditions.checkNotNull(context);
+ this.context = requireNonNull(context);
}
static ReplicatedLog newInstance(final Snapshot snapshot, final RaftActorContext context) {
}
@Override
- public boolean appendAndPersist(@Nonnull final ReplicatedLogEntry replicatedLogEntry,
- @Nullable final Procedure<ReplicatedLogEntry> callback, final boolean doAsync) {
+ public boolean appendAndPersist(final ReplicatedLogEntry replicatedLogEntry,
+ final Procedure<ReplicatedLogEntry> callback, final boolean doAsync) {
context.getLogger().debug("{}: Append log entry and persist {} ", context.getId(), replicatedLogEntry);
* 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.raft;
import akka.persistence.SnapshotSelectionCriteria;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.io.FileBackedOutputStream;
import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshot;
this.snapshotCohort = snapshotCohort;
}
- @Nonnull
- public Snapshot.State convertSnapshot(final ByteSource snapshotBytes) throws IOException {
+ public Snapshot.@NonNull State convertSnapshot(final ByteSource snapshotBytes) throws IOException {
return snapshotCohort.deserializeSnapshot(snapshotBytes);
}
* 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.raft.base.messages;
+import static java.util.Objects.requireNonNull;
+
import akka.dispatch.ControlMessage;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
/**
private final Snapshot snapshot;
private final Callback callback;
- public ApplySnapshot(Snapshot snapshot) {
+ public ApplySnapshot(@NonNull Snapshot snapshot) {
this(snapshot, NOOP_CALLBACK);
}
- public ApplySnapshot(@Nonnull Snapshot snapshot, @Nonnull Callback callback) {
- this.snapshot = Preconditions.checkNotNull(snapshot);
- this.callback = Preconditions.checkNotNull(callback);
+ public ApplySnapshot(@NonNull Snapshot snapshot, @NonNull Callback callback) {
+ this.snapshot = requireNonNull(snapshot);
+ this.callback = requireNonNull(callback);
}
- @Nonnull
- public Snapshot getSnapshot() {
+ public @NonNull Snapshot getSnapshot() {
return snapshot;
}
- @Nonnull
- public Callback getCallback() {
+ public @NonNull Callback getCallback() {
return callback;
}
*/
package org.opendaylight.controller.cluster.raft.base.messages;
+import static java.util.Objects.requireNonNull;
+
import akka.dispatch.ControlMessage;
-import com.google.common.base.Preconditions;
import java.io.OutputStream;
import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
public class CaptureSnapshotReply implements ControlMessage {
private final Snapshot.State snapshotState;
private final Optional<OutputStream> installSnapshotStream;
- public CaptureSnapshotReply(@Nonnull final Snapshot.State snapshotState,
- @Nonnull final Optional<OutputStream> installSnapshotStream) {
- this.snapshotState = Preconditions.checkNotNull(snapshotState);
- this.installSnapshotStream = Preconditions.checkNotNull(installSnapshotStream);
+ public CaptureSnapshotReply(final Snapshot.@NonNull State snapshotState,
+ final @NonNull Optional<OutputStream> installSnapshotStream) {
+ this.snapshotState = requireNonNull(snapshotState);
+ this.installSnapshotStream = requireNonNull(installSnapshotStream);
}
- @Nonnull
- public Snapshot.State getSnapshotState() {
+ public Snapshot.@NonNull State getSnapshotState() {
return snapshotState;
}
- @Nonnull
- public Optional<OutputStream> getInstallSnapshotStream() {
+ public @NonNull Optional<OutputStream> getInstallSnapshotStream() {
return installSnapshotStream;
}
}
* 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.raft.base.messages;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
/**
* The FollowerInitialSyncUpStatus is sent by a Follower to inform any RaftActor subclass whether the Follower
private final boolean initialSyncDone;
private final String name;
- public FollowerInitialSyncUpStatus(final boolean initialSyncDone, @Nonnull final String name) {
+ public FollowerInitialSyncUpStatus(final boolean initialSyncDone, final @NonNull String name) {
this.initialSyncDone = initialSyncDone;
- this.name = Preconditions.checkNotNull(name);
+ this.name = requireNonNull(name);
}
public boolean isInitialSyncDone() {
return initialSyncDone;
}
- @Nonnull public String getName() {
+ public @NonNull String getName() {
return name;
}
}
*/
package org.opendaylight.controller.cluster.raft.base.messages;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Message sent from a leader to its followers to indicate leadership transfer is starting.
private final String leaderId;
- public LeaderTransitioning(@Nonnull final String leaderId) {
- this.leaderId = Preconditions.checkNotNull(leaderId);
+ public LeaderTransitioning(final @NonNull String leaderId) {
+ this.leaderId = requireNonNull(leaderId);
}
- @Nonnull
- public String getLeaderId() {
+ public @NonNull String getLeaderId() {
return leaderId;
}
* 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.raft.base.messages;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.io.ByteSource;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
/**
* prompt the leader to install the snapshot on its followers as needed.
*/
public final class SendInstallSnapshot {
- private final Snapshot snapshot;
- private final ByteSource snapshotBytes;
+ private final @NonNull Snapshot snapshot;
+ private final @NonNull ByteSource snapshotBytes;
- public SendInstallSnapshot(@Nonnull Snapshot snapshot, @Nonnull ByteSource snapshotBytes) {
- this.snapshot = Preconditions.checkNotNull(snapshot);
- this.snapshotBytes = Preconditions.checkNotNull(snapshotBytes);
+ public SendInstallSnapshot(@NonNull Snapshot snapshot, @NonNull ByteSource snapshotBytes) {
+ this.snapshot = requireNonNull(snapshot);
+ this.snapshotBytes = requireNonNull(snapshotBytes);
}
- @Nonnull
- public Snapshot getSnapshot() {
+ public @NonNull Snapshot getSnapshot() {
return snapshot;
}
- public ByteSource getSnapshotBytes() {
+ public @NonNull ByteSource getSnapshotBytes() {
return snapshotBytes;
}
}
* 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.raft.behaviors;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.Cancellable;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
import com.google.common.io.ByteSource;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.io.SharedFileBackedOutputStream;
import org.opendaylight.controller.cluster.messaging.MessageSlicer;
import org.opendaylight.controller.cluster.messaging.SliceOptions;
private int minReplicationCount;
protected AbstractLeader(final RaftActorContext context, final RaftState state,
- @Nullable final AbstractLeader initializeFromLeader) {
+ final @Nullable AbstractLeader initializeFromLeader) {
super(context, state);
appendEntriesMessageSlicer = MessageSlicer.builder().logContext(logName())
}
@VisibleForTesting
- void setSnapshotHolder(@Nullable final SnapshotHolder snapshotHolder) {
+ void setSnapshotHolder(final @Nullable SnapshotHolder snapshotHolder) {
this.snapshotHolder = Optional.fromNullable(snapshotHolder);
}
@Override
public RaftActorBehavior handleMessage(final ActorRef sender, final Object message) {
- Preconditions.checkNotNull(sender, "sender should not be null");
+ requireNonNull(sender, "sender should not be null");
if (appendEntriesMessageSlicer.handleMessage(message)) {
return this;
return this;
}
+ @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS",
+ justification = "JDT nullness with SpotBugs at setSnapshotHolder(null)")
private void handleInstallSnapshotReply(final InstallSnapshotReply reply) {
log.debug("{}: handleInstallSnapshotReply: {}", logName(), reply);
* 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.raft.behaviors;
import akka.actor.ActorRef;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.messaging.MessageAssembler;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
}
@VisibleForTesting
- protected final void setLeaderId(@Nullable final String leaderId) {
+ protected final void setLeaderId(final @Nullable String leaderId) {
this.leaderId = leaderId;
}
package org.opendaylight.controller.cluster.raft.behaviors;
import akka.actor.ActorRef;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
*/
package org.opendaylight.controller.cluster.raft.behaviors;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
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.raft.FollowerLogInformation;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftActorLeadershipTransferCohort;
static final Object ISOLATED_LEADER_CHECK = new Object();
private final Stopwatch isolatedLeaderCheck = Stopwatch.createStarted();
- @Nullable private LeadershipTransferContext leadershipTransferContext;
+ private @Nullable LeadershipTransferContext leadershipTransferContext;
Leader(RaftActorContext context, @Nullable AbstractLeader initializeFromLeader) {
super(context, RaftState.Leader, initializeFromLeader);
@Override
public RaftActorBehavior handleMessage(ActorRef sender, Object originalMessage) {
- Preconditions.checkNotNull(sender, "sender should not be null");
+ requireNonNull(sender, "sender should not be null");
if (ISOLATED_LEADER_CHECK.equals(originalMessage)) {
if (isLeaderIsolated()) {
*
* @param leadershipTransferCohort the cohort participating in the leadership transfer
*/
- public void transferLeadership(@Nonnull RaftActorLeadershipTransferCohort leadershipTransferCohort) {
+ public void transferLeadership(@NonNull RaftActorLeadershipTransferCohort leadershipTransferCohort) {
log.debug("{}: Attempting to transfer leadership", logName());
leadershipTransferContext = new LeadershipTransferContext(leadershipTransferCohort);
* 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.raft.behaviors;
import akka.actor.ActorRef;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.raft.RaftState;
/**
*
* @return The new behavior or current behavior, or null if the message was not handled.
*/
- @Nullable
- RaftActorBehavior handleMessage(ActorRef sender, Object message);
+ @Nullable RaftActorBehavior handleMessage(ActorRef sender, Object message);
/**
* Returns the state associated with this behavior.
*
* @return the id of the leader or null if not known
*/
- @Nullable
- String getLeaderId();
+ @Nullable String getLeaderId();
/**
* Sets the index of the last log entry that has been replicated to all peers.
* 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.raft.client.messages;
import com.google.common.annotations.VisibleForTesting;
import java.io.Serializable;
import java.util.Optional;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Reply to {@link FindLeader} message, containing the address of the leader actor, as known to the raft actor which
private static final long serialVersionUID = 1L;
private final String leaderActor;
- public FindLeaderReply(@Nullable final String leaderActor) {
+ public FindLeaderReply(final @Nullable String leaderActor) {
this.leaderActor = leaderActor;
}
*/
package org.opendaylight.controller.cluster.raft.client.messages;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
/**
private final String id;
private final Snapshot snapshot;
- public GetSnapshotReply(@Nonnull String id, @Nonnull Snapshot snapshot) {
- this.id = Preconditions.checkNotNull(id);
- this.snapshot = Preconditions.checkNotNull(snapshot);
+ public GetSnapshotReply(@NonNull String id, @NonNull Snapshot snapshot) {
+ this.id = requireNonNull(id);
+ this.snapshot = requireNonNull(snapshot);
}
- @Nonnull
- public String getId() {
+ public @NonNull String getId() {
return id;
}
@SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Exposes a mutable object stored in a field but "
+ "this is OK since this class is merely a DTO and does not process the byte[] internally. "
+ "Also it would be inefficient to create a return copy as the byte[] could be large.")
- @Nonnull
- public Snapshot getSnapshot() {
+ public @NonNull Snapshot getSnapshot() {
return snapshot;
}
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* The response to a GetOnDemandRaftState message.
return (B) this;
}
- @Nonnull
- protected abstract OnDemandRaftState state();
+ protected abstract @NonNull OnDemandRaftState state();
public B lastLogIndex(long value) {
state().lastLogIndex = value;
*/
package org.opendaylight.controller.cluster.raft.messages;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
import java.io.Serializable;
import java.util.Optional;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Abstract base class for a server configuration change reply.
private final String leaderHint;
private final ServerChangeStatus status;
- AbstractServerChangeReply(final @Nonnull ServerChangeStatus status, final @Nullable String leaderHint) {
- this.status = Preconditions.checkNotNull(status);
+ AbstractServerChangeReply(final @NonNull ServerChangeStatus status, final @Nullable String leaderHint) {
+ this.status = requireNonNull(status);
this.leaderHint = leaderHint;
}
@VisibleForTesting
- @Nonnull public final Optional<String> getLeaderHint() {
+ public final @NonNull Optional<String> getLeaderHint() {
return Optional.ofNullable(leaderHint);
}
- @Nonnull public final ServerChangeStatus getStatus() {
+ public final @NonNull ServerChangeStatus getStatus() {
return status;
}
* 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.raft.messages;
import static java.util.Objects.requireNonNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
-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.RaftVersions;
import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
import org.opendaylight.controller.cluster.raft.persisted.SimpleReplicatedLogEntry;
private final String leaderAddress;
- private AppendEntries(long term, @Nonnull String leaderId, long prevLogIndex, long prevLogTerm,
- @Nonnull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
+ private AppendEntries(long term, @NonNull String leaderId, long prevLogIndex, long prevLogTerm,
+ @NonNull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
short payloadVersion, short recipientRaftVersion, short leaderRaftVersion, @Nullable String leaderAddress) {
super(term);
this.leaderId = requireNonNull(leaderId);
this.leaderAddress = leaderAddress;
}
- public AppendEntries(long term, @Nonnull String leaderId, long prevLogIndex, long prevLogTerm,
- @Nonnull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
+ public AppendEntries(long term, @NonNull String leaderId, long prevLogIndex, long prevLogTerm,
+ @NonNull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
short payloadVersion, short recipientRaftVersion, @Nullable String leaderAddress) {
this(term, leaderId, prevLogIndex, prevLogTerm, entries, leaderCommit, replicatedToAllIndex, payloadVersion,
recipientRaftVersion, RaftVersions.CURRENT_VERSION, leaderAddress);
}
@VisibleForTesting
- public AppendEntries(long term, @Nonnull String leaderId, long prevLogIndex, long prevLogTerm,
- @Nonnull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
+ public AppendEntries(long term, @NonNull String leaderId, long prevLogIndex, long prevLogTerm,
+ @NonNull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
short payloadVersion) {
this(term, leaderId, prevLogIndex, prevLogTerm, entries, leaderCommit, replicatedToAllIndex, payloadVersion,
RaftVersions.CURRENT_VERSION, null);
}
- @Nonnull
- public String getLeaderId() {
+ public @NonNull String getLeaderId() {
return leaderId;
}
return prevLogTerm;
}
- @Nonnull
- public List<ReplicatedLogEntry> getEntries() {
+ public @NonNull List<ReplicatedLogEntry> getEntries() {
return entries;
}
*/
package org.opendaylight.controller.cluster.raft.messages;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.collect.ImmutableSet;
import java.io.Serializable;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Message sent to change the raft voting status for servers.
private final Map<String, Boolean> serverVotingStatusMap;
private final Collection<String> serversVisited;
- public ChangeServersVotingStatus(@Nonnull Map<String, Boolean> serverVotingStatusMap) {
- this(serverVotingStatusMap, Collections.emptySet());
+ public ChangeServersVotingStatus(@NonNull Map<String, Boolean> serverVotingStatusMap) {
+ this(serverVotingStatusMap, ImmutableSet.of());
}
- public ChangeServersVotingStatus(@Nonnull Map<String, Boolean> serverVotingStatusMap,
- @Nonnull Collection<String> serversVisited) {
- this.serverVotingStatusMap = new HashMap<>(Preconditions.checkNotNull(serverVotingStatusMap));
- this.serversVisited = ImmutableSet.copyOf(Preconditions.checkNotNull(serversVisited));
+ public ChangeServersVotingStatus(@NonNull Map<String, Boolean> serverVotingStatusMap,
+ @NonNull Collection<String> serversVisited) {
+ this.serverVotingStatusMap = new HashMap<>(requireNonNull(serverVotingStatusMap));
+ this.serversVisited = ImmutableSet.copyOf(requireNonNull(serversVisited));
}
- @Nonnull
- public Map<String, Boolean> getServerVotingStatusMap() {
+ public @NonNull Map<String, Boolean> getServerVotingStatusMap() {
return serverVotingStatusMap;
}
- @Nonnull
- public Collection<String> getServersVisited() {
+ public @NonNull Collection<String> getServersVisited() {
return serversVisited;
}
* 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.raft.messages;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Reply to a RemoveServer message (§4.1).
package org.opendaylight.controller.cluster.raft.persisted;
import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Transitional marker interface for use with evolution of serializable classes held in persistence. This interface
*
* @return Serialization proxy.
*/
- @Nonnull Object writeReplace();
+ @NonNull Object writeReplace();
}
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
import org.opendaylight.controller.cluster.raft.protobuff.client.messages.PersistentPayload;
import org.slf4j.Logger;
private final List<ServerInfo> serverConfig;
private int serializedSize = -1;
- public ServerConfigurationPayload(@Nonnull final List<ServerInfo> serverConfig) {
+ public ServerConfigurationPayload(final @NonNull List<ServerInfo> serverConfig) {
this.serverConfig = ImmutableList.copyOf(serverConfig);
}
- @Nonnull
- public List<ServerInfo> getServerConfig() {
+ public @NonNull List<ServerInfo> getServerConfig() {
return serverConfig;
}
*/
package org.opendaylight.controller.cluster.raft.persisted;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
/**
* Server information. This class is not directly Serializable, as it is serialized directly as part of
private final String id;
private final boolean isVoting;
- public ServerInfo(@Nonnull String id, boolean isVoting) {
- this.id = Preconditions.checkNotNull(id);
+ public ServerInfo(@NonNull String id, boolean isVoting) {
+ this.id = requireNonNull(id);
this.isVoting = isVoting;
}
- @Nonnull
- public String getId() {
+ public @NonNull String getId() {
return id;
}
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
import org.apache.commons.lang3.SerializationUtils;
import org.opendaylight.controller.cluster.DataPersistenceProvider;
import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior;
}
@Override
- @Nonnull
protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
return this;
}
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
import org.apache.commons.lang3.SerializationUtils;
+import org.eclipse.jdt.annotation.Nullable;
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.controller.cluster.raft.MockRaftActorContext.MockPayload;
*/
package org.opendaylight.controller.cluster.raft.persisted;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.Arrays;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Snapshot State implementation backed by a byte[].
public final class ByteState implements Snapshot.State {
private static final long serialVersionUID = 1L;
- private final byte[] bytes;
+ private final byte @NonNull[] bytes;
- private ByteState(@Nonnull final byte[] bytes) {
- this.bytes = Preconditions.checkNotNull(bytes);
+ private ByteState(final byte @NonNull[] bytes) {
+ this.bytes = requireNonNull(bytes);
}
- public static ByteState of(@Nonnull final byte[] bytes) {
+ public static @NonNull ByteState of(final byte @NonNull[] bytes) {
return new ByteState(bytes);
}
- public static ByteState empty() {
+ public static @NonNull ByteState empty() {
return new ByteState(new byte[0]);
}
- public byte[] getBytes() {
+ public byte @NonNull[] getBytes() {
return bytes;
}
* 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.md.sal.binding.api;
import com.google.common.collect.Collections2;
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.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.ChildOf;
import org.opendaylight.yangtools.yang.binding.ChoiceIn;
*
* @return type of modified object.
*/
- @Nonnull Class<T> getDataType();
+ @NonNull Class<T> getDataType();
/**
* Returns type of modification.
*
* @return type Type of performed modification.
*/
- @Nonnull ModificationType getModificationType();
+ @NonNull ModificationType getModificationType();
/**
* Returns before-state of top level container. Implementations are encouraged,
*
* @return unmodifiable collection of modified direct children.
*/
- @Nonnull Collection<? extends DataObjectModification<? extends DataObject>> getModifiedChildren();
+ @NonNull Collection<? extends DataObjectModification<? extends DataObject>> getModifiedChildren();
/**
* Returns child list item modification if {@code child} was modified by this modification. This method should be
* to generated model.
*/
default <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>>
- Collection<DataObjectModification<C>> getModifiedChildren(@Nonnull final Class<H> caseType,
- @Nonnull final Class<C> childType) {
+ Collection<DataObjectModification<C>> getModifiedChildren(final @NonNull Class<H> caseType,
+ final @NonNull Class<C> childType) {
final Item<C> item = Item.of(caseType, childType);
return (Collection<DataObjectModification<C>>) Collections2.filter(getModifiedChildren(),
mod -> item.equals(mod.getIdentifier()));
* to generated model.
*/
default @Nullable <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>>
- DataObjectModification<C> getModifiedChildContainer(@Nonnull final Class<H> caseType,
- @Nonnull final Class<C> child) {
+ DataObjectModification<C> getModifiedChildContainer(final @NonNull Class<H> caseType,
+ final @NonNull Class<C> child) {
return (DataObjectModification<C>) getModifiedChild(Item.of(caseType, child));
}
* to generated model.
*/
@Nullable <C extends ChildOf<? super T>> DataObjectModification<C> getModifiedChildContainer(
- @Nonnull Class<C> child);
+ @NonNull Class<C> child);
/**
* Returns augmentation child modification if {@code augmentation} was modified by this modification.
* according to generated model.
*/
@Nullable <C extends Augmentation<T> & DataObject> DataObjectModification<C> getModifiedAugmentation(
- @Nonnull Class<C> augmentation);
+ @NonNull Class<C> augmentation);
/**
* Returns child list item modification if {@code child} was modified by this modification.
* to generated model.
*/
<N extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<N>> DataObjectModification<N>
- getModifiedChildListItem(@Nonnull Class<N> listItem, @Nonnull K listKey);
+ getModifiedChildListItem(@NonNull Class<N> listItem, @NonNull K listKey);
/**
* Returns child list item modification if {@code child} was modified by this modification.
*/
default <H extends ChoiceIn<? super T> & DataObject, C extends Identifiable<K> & ChildOf<? super H>,
K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
- @Nonnull final Class<H> caseType, @Nonnull final Class<C> listItem, @Nonnull final K listKey) {
+ final @NonNull Class<H> caseType, final @NonNull Class<C> listItem, final @NonNull K listKey) {
return (DataObjectModification<C>) getModifiedChild(IdentifiableItem.of(caseType, listItem, listKey));
}
import java.util.Collection;
import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.binding.DataObject;
/**
*
* @param changes Collection of change events, may not be null or empty.
*/
- void onDataTreeChanged(@Nonnull Collection<DataTreeModification<T>> changes);
+ void onDataTreeChanged(@NonNull Collection<DataTreeModification<T>> changes);
}
*/
package org.opendaylight.controller.md.sal.binding.api;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.DataObject;
* your listener using {@link ListenerRegistration#close()} to stop
* delivery of change events.
*/
- @Nonnull <T extends DataObject,L extends DataTreeChangeListener<T>> ListenerRegistration<L>
- registerDataTreeChangeListener(@Nonnull DataTreeIdentifier<T> treeId, @Nonnull L listener);
+ <T extends DataObject, L extends DataTreeChangeListener<T>> @NonNull ListenerRegistration<L>
+ registerDataTreeChangeListener(@NonNull DataTreeIdentifier<T> treeId, @NonNull L listener);
}
*/
package org.opendaylight.controller.md.sal.binding.api;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.concepts.Path;
public final class DataTreeIdentifier<T extends DataObject> implements Immutable,
Path<DataTreeIdentifier<?>>, Serializable {
private static final long serialVersionUID = 1L;
- private final InstanceIdentifier<T> rootIdentifier;
- private final LogicalDatastoreType datastoreType;
+
+ private final @NonNull InstanceIdentifier<T> rootIdentifier;
+ private final @NonNull LogicalDatastoreType datastoreType;
public DataTreeIdentifier(final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> rootIdentifier) {
- this.datastoreType = Preconditions.checkNotNull(datastoreType);
- this.rootIdentifier = Preconditions.checkNotNull(rootIdentifier);
+ this.datastoreType = requireNonNull(datastoreType);
+ this.rootIdentifier = requireNonNull(rootIdentifier);
}
/**
*
* @return Logical data store type. Guaranteed to be non-null.
*/
- public @Nonnull LogicalDatastoreType getDatastoreType() {
+ public @NonNull LogicalDatastoreType getDatastoreType() {
return datastoreType;
}
*
* @return Instance identifier corresponding to the root node.
*/
- public @Nonnull InstanceIdentifier<T> getRootIdentifier() {
+ public @NonNull InstanceIdentifier<T> getRootIdentifier() {
return rootIdentifier;
}
* 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.md.sal.binding.api;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.binding.DataObject;
/**
*
* @return absolute path of the root node
*/
- @Nonnull DataTreeIdentifier<T> getRootPath();
+ @NonNull DataTreeIdentifier<T> getRootPath();
/**
* Get the modification root node.
*
* @return modification root node
*/
- @Nonnull DataObjectModification<T> getRootNode();
-
+ @NonNull DataObjectModification<T> getRootNode();
}
package org.opendaylight.controller.md.sal.binding.api;
import com.google.common.collect.ForwardingObject;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.DataObject;
public abstract class ForwardingDataBroker extends ForwardingObject implements DataBroker {
@Override
- protected abstract @Nonnull DataBroker delegate();
+ protected abstract @NonNull DataBroker delegate();
@Override
public ReadOnlyTransaction newReadOnlyTransaction() {
*/
package org.opendaylight.controller.md.sal.binding.compat;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.impl.LazySerializedDOMNotification;
import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
}
@Override
- public void onNotification(@Nonnull final DOMNotification notification) {
+ public void onNotification(final DOMNotification notification) {
delegate.onNotification(type.cast(deserialize(notification)));
}
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
import org.opendaylight.mdsal.binding.dom.adapter.invoke.NotificationListenerInvoker;
}
@Override
- public void onNotification(@Nonnull final DOMNotification notification) {
+ public void onNotification(final DOMNotification notification) {
final Notification baNotification = deserialize(notification);
final QName notificationQName = notification.getType().getLastComponent();
getInvoker(notification.getType()).invokeNotification(delegate, notificationQName, baNotification);
*/
package org.opendaylight.controller.md.sal.binding.impl;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.util.concurrent.CheckedFuture;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
throw new IllegalArgumentException("Failed to create invokers for type " + type, e);
}
- this.codec = Preconditions.checkNotNull(codec);
- this.delegate = Preconditions.checkNotNull(delegate);
+ this.codec = requireNonNull(codec);
+ this.delegate = requireNonNull(delegate);
inputQname = QName.create(BindingReflections.getQNameModule(type), "input").intern();
}
- @Nonnull
@Override
- public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
+ public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc,
final NormalizedNode<?, ?> input) {
final SchemaPath schemaPath = rpc.getType();
final DataObject bindingInput = input != null ? deserialize(rpc.getType(), input) : null;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Map;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationOperation;
import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
}
@Override
- @Nonnull
public Map.Entry<InstanceIdentifier<?>, BindingCodecTreeNode<?>> getSubtreeCodec(
final YangInstanceIdentifier domIdentifier) {
return super.getSubtreeCodec(domIdentifier);
* 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.md.sal.binding.impl;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import java.lang.reflect.Method;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
*/
abstract @Nullable InstanceIdentifier<?> extract(DataObject obj);
- @Nonnull
- private static ContextReferenceExtractor create(final Class<?> key) {
+ private static @NonNull ContextReferenceExtractor create(final Class<?> key) {
final Method contextGetter = getContextGetter(key);
if (contextGetter == null) {
return NULL_EXTRACTOR;
return NULL_EXTRACTOR;
}
- @Nullable
- private static Method findGetValueMethod(final Class<?> type, final Class<?> returnType) {
+ private static @Nullable Method findGetValueMethod(final Class<?> type, final Class<?> returnType) {
try {
final Method method = type.getMethod(GET_VALUE_NAME);
if (returnType.equals(method.getReturnType())) {
import com.google.common.base.Optional;
import com.google.common.cache.CacheLoader;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
public abstract class AdapterLoader<T, D> extends CacheLoader<Class<? extends T>, Optional<T>> {
return Optional.<T>of(builder.build());
}
- @Nullable
- protected abstract D getDelegate(Class<? extends D> reqDeleg);
+ protected abstract @Nullable D getDelegate(Class<? extends D> reqDeleg);
- @Nonnull
- protected abstract AdapterBuilder<? extends T, D> createBuilder(Class<? extends T> key);
+ protected abstract @NonNull AdapterBuilder<? extends T, D> createBuilder(Class<? extends T> key);
}
package org.opendaylight.controller.cluster;
import akka.actor.ActorSystem;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
/**
*
* @return the ActorSystem.
*/
- @Nonnull
- ActorSystem getActorSystem();
+ @NonNull ActorSystem getActorSystem();
/**
* Register a listener for ActorSystem lifecycle events.
* @return a ListenerRegistration instance to be used to unregister
*/
ListenerRegistration<ActorSystemProviderListener> registerActorSystemProviderListener(
- @Nonnull ActorSystemProviderListener listener);
+ @NonNull ActorSystemProviderListener listener);
}
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
@Beta
public final class NormalizedNodeInputOutput {
* @return a new {@link NormalizedNodeDataInput} instance
* @throws IOException if an error occurs reading from the input
*/
- public static NormalizedNodeDataInput newDataInput(@Nonnull final DataInput input) throws IOException {
+ public static NormalizedNodeDataInput newDataInput(final @NonNull DataInput input) throws IOException {
final byte marker = input.readByte();
if (marker != TokenTypes.SIGNATURE_MARKER) {
throw new InvalidNormalizedNodeStreamException(String.format("Invalid signature marker: %d", marker));
* @param input the DataInput to read from
* @return a new {@link NormalizedNodeDataInput} instance
*/
- public static NormalizedNodeDataInput newDataInputWithoutValidation(@Nonnull final DataInput input) {
+ public static NormalizedNodeDataInput newDataInputWithoutValidation(final @NonNull DataInput input) {
return new NormalizedNodeInputStreamReader(input, false);
}
* @param output the DataOutput to write to
* @return a new {@link NormalizedNodeDataOutput} instance
*/
- public static NormalizedNodeDataOutput newDataOutput(@Nonnull final DataOutput output) {
+ public static NormalizedNodeDataOutput newDataOutput(final @NonNull DataOutput output) {
return new NormalizedNodeOutputStreamWriter(output);
}
}
*/
package org.opendaylight.controller.cluster.datastore.util;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Verify.verifyNotNull;
+
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
import java.util.Optional;
-import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
}
@Override
- public final void enter(@Nonnull final PathArgument child) {
+ public final void enter(final PathArgument child) {
current = current.node(child);
}
@Override
- public final void enter(@Nonnull final PathArgument... path) {
+ public final void enter(final PathArgument... path) {
for (PathArgument arg : path) {
enter(arg);
}
}
@Override
- public final void enter(@Nonnull final Iterable<PathArgument> path) {
+ public final void enter(final Iterable<PathArgument> path) {
for (PathArgument arg : path) {
enter(arg);
}
@Override
public final void exit() {
- Preconditions.checkState(!current.isEmpty());
- current = Verify.verifyNotNull(current.getParent());
+ checkState(!current.isEmpty());
+ current = verifyNotNull(current.getParent());
}
@Override
public final void exit(final int depth) {
- Preconditions.checkArgument(depth >= 0);
+ checkArgument(depth >= 0);
YangInstanceIdentifier next = current;
for (int i = 0; i < depth; ++i) {
next = next.getParent();
- Preconditions.checkState(next != null);
+ checkState(next != null);
}
current = next;
}
@Override
- public final Optional<NormalizedNode<?, ?>> readNode(@Nonnull final PathArgument child) {
+ public final Optional<NormalizedNode<?, ?>> readNode(final PathArgument child) {
throw new UnsupportedOperationException("Not implemented");
}
import java.nio.file.Files;
import java.util.Iterator;
import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @return a ByteSource instance
* @throws IOException if close fails
*/
- @Nonnull
- public synchronized ByteSource asByteSource() throws IOException {
+ public synchronized @NonNull ByteSource asByteSource() throws IOException {
close();
if (source == null) {
*/
package org.opendaylight.controller.cluster.io;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
/**
* A factory for creating {@link FileBackedOutputStream} instances.
*/
package org.opendaylight.controller.cluster.messaging;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.RemovalNotification;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
import org.opendaylight.yangtools.concepts.Identifier;
import org.slf4j.Logger;
private final String logContext;
MessageAssembler(final Builder builder) {
- this.fileBackedStreamFactory = Preconditions.checkNotNull(builder.fileBackedStreamFactory,
+ this.fileBackedStreamFactory = requireNonNull(builder.fileBackedStreamFactory,
"FiledBackedStreamFactory cannot be null");
- this.assembledMessageCallback = Preconditions.checkNotNull(builder.assembledMessageCallback,
+ this.assembledMessageCallback = requireNonNull(builder.assembledMessageCallback,
"assembledMessageCallback cannot be null");
this.logContext = builder.logContext;
* @param sendTo the reference of the actor to which subsequent message slices should be sent
* @return true if the message was handled, false otherwise
*/
- public boolean handleMessage(final Object message, final @Nonnull ActorRef sendTo) {
+ public boolean handleMessage(final Object message, final @NonNull ActorRef sendTo) {
if (message instanceof MessageSlice) {
LOG.debug("{}: handleMessage: {}", logContext, message);
onMessageSlice((MessageSlice) message, sendTo);
* @return this Builder
*/
public Builder fileBackedStreamFactory(final FileBackedOutputStreamFactory newFileBackedStreamFactory) {
- this.fileBackedStreamFactory = Preconditions.checkNotNull(newFileBackedStreamFactory);
+ this.fileBackedStreamFactory = requireNonNull(newFileBackedStreamFactory);
return this;
}
* @return this Builder
*/
public Builder expireStateAfterInactivity(final long duration, final TimeUnit unit) {
- Preconditions.checkArgument(duration > 0, "duration must be > 0");
+ checkArgument(duration > 0, "duration must be > 0");
this.expireStateAfterInactivityDuration = duration;
this.expireStateAfterInactivityUnit = unit;
return this;
*/
package org.opendaylight.controller.cluster.messaging;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.RemovalNotification;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Predicate;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.io.FileBackedOutputStream;
import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
import org.opendaylight.yangtools.concepts.Identifier;
if (message != null) {
LOG.debug("{}: slice: identifier: {}, message: {}", logContext, identifier, message);
- Preconditions.checkNotNull(fileBackedStreamFactory,
+ requireNonNull(fileBackedStreamFactory,
"The FiledBackedStreamFactory must be set in order to call this slice method");
// Serialize the message to a FileBackedOutputStream.
*
* @param filter filters by Identifier
*/
- public void cancelSlicing(@Nonnull final Predicate<Identifier> filter) {
+ public void cancelSlicing(final @NonNull Predicate<Identifier> filter) {
stateCache.asMap().keySet().removeIf(
messageSliceIdentifier -> filter.test(messageSliceIdentifier.getClientIdentifier()));
}
* @return this Builder
*/
public Builder fileBackedStreamFactory(final FileBackedOutputStreamFactory newFileBackedStreamFactory) {
- this.fileBackedStreamFactory = Preconditions.checkNotNull(newFileBackedStreamFactory);
+ this.fileBackedStreamFactory = requireNonNull(newFileBackedStreamFactory);
return this;
}
* @return this Builder
*/
public Builder messageSliceSize(final int newMessageSliceSize) {
- Preconditions.checkArgument(newMessageSliceSize > 0, "messageSliceSize must be > 0");
+ checkArgument(newMessageSliceSize > 0, "messageSliceSize must be > 0");
this.messageSliceSize = newMessageSliceSize;
return this;
}
* @return this Builder
*/
public Builder maxSlicingTries(final int newMaxSlicingTries) {
- Preconditions.checkArgument(newMaxSlicingTries > 0, "newMaxSlicingTries must be > 0");
+ checkArgument(newMaxSlicingTries > 0, "newMaxSlicingTries must be > 0");
this.maxSlicingTries = newMaxSlicingTries;
return this;
}
* @return this Builder
*/
public Builder expireStateAfterInactivity(final long duration, final TimeUnit unit) {
- Preconditions.checkArgument(duration > 0, "duration must be > 0");
+ checkArgument(duration > 0, "duration must be > 0");
this.expireStateAfterInactivityDuration = duration;
this.expireStateAfterInactivityUnit = unit;
return this;
* @return this Builder
*/
public Builder logContext(final String newLogContext) {
- this.logContext = Preconditions.checkNotNull(newLogContext);
+ this.logContext = requireNonNull(newLogContext);
return this;
}
*/
package org.opendaylight.controller.cluster.notifications;
-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;
/**
* A local message initiated internally from the RaftActor when some state of a leader has changed.
private final String leaderId;
private final short leaderPayloadVersion;
- public LeaderStateChanged(@Nonnull String memberId, @Nullable String leaderId, short leaderPayloadVersion) {
- this.memberId = Preconditions.checkNotNull(memberId);
+ public LeaderStateChanged(@NonNull String memberId, @Nullable String leaderId, short leaderPayloadVersion) {
+ this.memberId = requireNonNull(memberId);
this.leaderId = leaderId;
this.leaderPayloadVersion = leaderPayloadVersion;
}
- public @Nonnull String getMemberId() {
+ public @NonNull String getMemberId() {
return memberId;
}
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.concurrent.ExecutionContext;
.filter(criteria::matches).collect(Collectors.toList());
}
- private static Stream<SnapshotMetadata> toStream(@Nullable final SnapshotMetadata md) {
+ private static Stream<SnapshotMetadata> toStream(final @Nullable SnapshotMetadata md) {
return md != null ? Stream.of(md) : Stream.empty();
}
- @Nullable
- private static SnapshotMetadata extractMetadata(final File file) {
+ private static @Nullable SnapshotMetadata extractMetadata(final File file) {
String name = file.getName();
int sequenceNumberEndIndex = name.lastIndexOf('-');
int persistenceIdEndIndex = name.lastIndexOf('-', sequenceNumberEndIndex - 1);
* 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.schema.provider;
import com.google.common.annotations.Beta;
import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.schema.provider.impl.YangTextSchemaSourceSerializationProxy;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import scala.concurrent.Future;
Future<Set<SourceIdentifier>> getProvidedSources();
- Future<YangTextSchemaSourceSerializationProxy> getYangTextSchemaSource(@Nonnull SourceIdentifier identifier);
+ Future<YangTextSchemaSourceSerializationProxy> getYangTextSchemaSource(@NonNull SourceIdentifier identifier);
}
* 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.schema.provider.impl;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.io.IOException;
import java.util.Set;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.cluster.schema.provider.RemoteYangTextSourceProvider;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
public RemoteYangTextSourceProviderImpl(final SchemaRepository repository,
final Set<SourceIdentifier> providedSources) {
- this.repository = Preconditions.checkNotNull(repository);
+ this.repository = requireNonNull(repository);
this.providedSources = providedSources;
}
Futures.addCallback(future, new FutureCallback<YangTextSchemaSource>() {
@Override
- public void onSuccess(@Nonnull final YangTextSchemaSource result) {
+ public void onSuccess(final YangTextSchemaSource result) {
try {
promise.success(new YangTextSchemaSourceSerializationProxy(result));
} catch (IOException e) {
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Function;
-import javax.annotation.Nonnull;
/**
* An implementation of CheckedFuture that provides similar behavior for the <code>get</code> methods
@Override
@SuppressWarnings("checkstyle:parameterName")
- protected X mapException(@Nonnull final Exception e) {
+ protected X mapException(final Exception e) {
return mapper.apply(e);
}
}
@Override
- public V get(final long timeout, @Nonnull final TimeUnit unit)
+ public V get(final long timeout, final TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
try {
return super.get(timeout, unit);
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import javax.annotation.CheckReturnValue;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.MappingCheckedFuture;
import org.opendaylight.mdsal.common.api.CommitInfo;
* @deprecated Use {@link #commit()} instead.
*/
@Deprecated
- @CheckReturnValue
default CheckedFuture<Void, TransactionCommitFailedException> submit() {
return MappingCheckedFuture.create(commit().transform(ignored -> null, MoreExecutors.directExecutor()),
SUBMIT_EXCEPTION_MAPPER);
* {@link TransactionCommitFailedException} or an exception derived from TransactionCommitFailedException.
* @throws IllegalStateException if the transaction is already committed or was canceled.
*/
- @CheckReturnValue
@NonNull FluentFuture<? extends @NonNull CommitInfo> commit();
/**
* 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.md.sal.common.util.jmx;
import com.google.common.annotations.Beta;
import java.lang.management.ManagementFactory;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanRegistrationException;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @param beanType Used as the <code>type</code> property in the bean's ObjectName.
* @param beanCategory Used as the <code>Category</code> property in the bean's ObjectName.
*/
- protected AbstractMXBean(@Nonnull String beanName, @Nonnull String beanType,
+ protected AbstractMXBean(@NonNull String beanName, @NonNull String beanType,
@Nullable String beanCategory) {
this.beanName = beanName;
this.beanType = beanType;
* 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.md.sal.common.util.jmx;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.util.concurrent.CountingRejectedExecutionHandler;
import org.opendaylight.yangtools.util.concurrent.TrackingLinkedBlockingQueue;
import org.slf4j.Logger;
* @param beanCategory Used as the <code>Category</code> property in the bean's ObjectName.
*/
public ThreadExecutorStatsMXBeanImpl(final ThreadPoolExecutor executor, final String beanName,
- final String beanType, @Nullable final String beanCategory) {
+ final String beanType, final @Nullable String beanCategory) {
super(beanName, beanType, beanCategory);
- this.executor = Preconditions.checkNotNull(executor);
+ this.executor = requireNonNull(executor);
}
private static ThreadExecutorStatsMXBeanImpl createInternal(final Executor executor,
* is a ThreadPoolExecutor, otherwise null.
*/
public static ThreadExecutorStatsMXBeanImpl create(final Executor executor, final String beanName,
- final String beanType, @Nullable final String beanCategory) {
+ final String beanType, final @Nullable String beanCategory) {
ThreadExecutorStatsMXBeanImpl ret = createInternal(executor, beanName, beanType, beanCategory);
if (ret != null) {
ret.registerMBean();
package org.opendaylight.controller.cluster.sharding;
import static akka.actor.ActorRef.noSender;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
import akka.actor.ActorRef;
import akka.actor.PoisonPill;
import akka.dispatch.OnComplete;
import akka.util.Timeout;
import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.cluster.datastore.exceptions.LocalShardNotFoundException;
import org.opendaylight.controller.cluster.datastore.messages.MakeLeaderLocal;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import scala.compat.java8.FutureConverters;
import scala.concurrent.Future;
-
/**
* Default {@link CDSShardAccess} implementation. Listens on leader location
* change events and distributes them to registered listeners. Also updates
private volatile boolean closed = false;
CDSShardAccessImpl(final DOMDataTreeIdentifier prefix, final ActorContext actorContext) {
- this.prefix = Preconditions.checkNotNull(prefix);
- this.actorContext = Preconditions.checkNotNull(actorContext);
+ this.prefix = requireNonNull(prefix);
+ this.actorContext = requireNonNull(actorContext);
this.makeLeaderLocalTimeout =
new Timeout(actorContext.getDatastoreContext().getShardLeaderElectionTimeout().duration().$times(2));
// TODO Maybe we should do this in async
final Optional<ActorRef> localShardReply =
actorContext.findLocalShard(ClusterUtils.getCleanShardName(prefix.getRootIdentifier()));
- Preconditions.checkState(localShardReply.isPresent(),
+ checkState(localShardReply.isPresent(),
"Local shard for {} not present. Cannot register RoleChangeListenerActor", prefix);
roleChangeListenerActor =
actorContext.getActorSystem().actorOf(RoleChangeListenerActor.props(localShardReply.get(), this));
}
private void checkNotClosed() {
- Preconditions.checkState(!closed,
- "CDSDataTreeProducer, that this CDSShardAccess is associated with, is no longer valid");
+ checkState(!closed, "CDSDataTreeProducer, that this CDSShardAccess is associated with, is no longer valid");
}
@Override
- @Nonnull
public DOMDataTreeIdentifier getShardIdentifier() {
checkNotClosed();
return prefix;
}
@Override
- @Nonnull
public LeaderLocation getLeaderLocation() {
checkNotClosed();
// TODO before getting first notification from roleChangeListenerActor
}
@Override
- @Nonnull
public CompletionStage<Void> makeLeaderLocal() {
// TODO when we have running make leader local operation
// we should just return the same completion stage
}
@Override
- @Nonnull
public <L extends LeaderLocationListener> LeaderLocationListenerRegistration<L>
- registerLeaderLocationListener(@Nonnull final L listener) {
+ registerLeaderLocationListener(final L listener) {
checkNotClosed();
- Preconditions.checkNotNull(listener);
- Preconditions.checkArgument(!listeners.contains(listener),
- "Listener {} is already registered with ShardAccess {}", listener, this);
+ requireNonNull(listener);
+ checkArgument(!listeners.contains(listener), "Listener %s is already registered with ShardAccess %s", listener,
+ this);
LOG.debug("Registering LeaderLocationListener {}", listener);
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
- public void onLeaderLocationChanged(@Nonnull final LeaderLocation location) {
+ public void onLeaderLocationChanged(final LeaderLocation location) {
if (closed) {
// we are closed already. Do not dispatch any new leader location
// change events.
import java.util.Collection;
import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
/**
*
* @param changes Collection of change events, may not be null or empty.
*/
- void onDataTreeChanged(@Nonnull Collection<DataTreeCandidate> changes);
+ void onDataTreeChanged(@NonNull Collection<DataTreeCandidate> changes);
}
*/
package org.opendaylight.controller.md.sal.dom.api;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
/**
* your listener using {@link ListenerRegistration#close()} to stop
* delivery of change events.
*/
- @Nonnull <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
- @Nonnull DOMDataTreeIdentifier treeId, @Nonnull L listener);
+ @NonNull <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
+ @NonNull DOMDataTreeIdentifier treeId, @NonNull 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
*/
-
package org.opendaylight.controller.md.sal.dom.api;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
import java.io.Serializable;
import java.util.Iterator;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.concepts.Path;
public final class DOMDataTreeIdentifier implements Immutable,
Path<DOMDataTreeIdentifier>, Serializable, Comparable<DOMDataTreeIdentifier> {
private static final long serialVersionUID = 1L;
- private final YangInstanceIdentifier rootIdentifier;
- private final LogicalDatastoreType datastoreType;
+ private final @NonNull YangInstanceIdentifier rootIdentifier;
+ private final @NonNull LogicalDatastoreType datastoreType;
public DOMDataTreeIdentifier(final LogicalDatastoreType datastoreType,
final YangInstanceIdentifier rootIdentifier) {
- this.datastoreType = Preconditions.checkNotNull(datastoreType);
- this.rootIdentifier = Preconditions.checkNotNull(rootIdentifier);
+ this.datastoreType = requireNonNull(datastoreType);
+ this.rootIdentifier = requireNonNull(rootIdentifier);
}
/**
*
* @return Logical data store type. Guaranteed to be non-null.
*/
- public @Nonnull LogicalDatastoreType getDatastoreType() {
+ public @NonNull LogicalDatastoreType getDatastoreType() {
return datastoreType;
}
*
* @return Instance identifier corresponding to the root node.
*/
- public @Nonnull YangInstanceIdentifier getRootIdentifier() {
+ public @NonNull YangInstanceIdentifier getRootIdentifier() {
return rootIdentifier;
}
import com.google.common.annotations.Beta;
import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Marker interface for services which can support {@link DOMServiceExtension}.
*
* @return A map of supported functionality.
*/
- @Nonnull Map<Class<? extends E>, E> getSupportedExtensions();
+ @NonNull Map<Class<? extends E>, E> getSupportedExtensions();
}
package org.opendaylight.controller.md.sal.dom.api;
import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* Interface implemented by listeners interested in {@link DOMNotification}s.
*
* @param notification Received notification
*/
- void onNotification(@Nonnull DOMNotification notification);
+ void onNotification(@NonNull DOMNotification notification);
}
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* A {@link DOMService} which allows its user to send {@link DOMNotification}s. It
* @throws InterruptedException if interrupted while waiting
* @throws NullPointerException if notification is null.
*/
- @Nonnull ListenableFuture<?> putNotification(@Nonnull DOMNotification notification) throws InterruptedException;
+ @NonNull ListenableFuture<?> putNotification(@NonNull DOMNotification notification) throws InterruptedException;
/**
* Attempt to publish a notification. The result of this method is a {@link ListenableFuture}
* the implementation from accepting the notification for delivery.
* @throws NullPointerException if notification is null.
*/
- @Nonnull ListenableFuture<?> offerNotification(@Nonnull DOMNotification notification);
+ @NonNull ListenableFuture<?> offerNotification(@NonNull DOMNotification notification);
/**
* Attempt to publish a notification. The result of this method is a {@link ListenableFuture}
* is guaranteed to block more than the specified timeout.
*
* @param notification Notification to be published.
- * @param timeout how long to wait before giving up, in units of unit
+ * @param timeout how long to wait before giving up, in units of unit, must not be negative
* @param unit a TimeUnit determining how to interpret the timeout parameter
* @return A listenable future which will report completion when the service
* has finished propagating the notification to its immediate registrants,
* @throws NullPointerException if notification or unit is null.
* @throws IllegalArgumentException if timeout is negative.
*/
- @Nonnull ListenableFuture<?> offerNotification(@Nonnull DOMNotification notification,
- @Nonnegative long timeout, @Nonnull TimeUnit unit) throws InterruptedException;
+ @NonNull ListenableFuture<?> offerNotification(@NonNull DOMNotification notification,
+ long timeout, @NonNull TimeUnit unit) throws InterruptedException;
}
package org.opendaylight.controller.md.sal.dom.api;
import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
* @throws NullPointerException if either of the arguments is null
*/
<T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(
- @Nonnull T listener, @Nonnull Collection<SchemaPath> types);
+ @NonNull T listener, @NonNull Collection<SchemaPath> types);
/**
* Register a {@link DOMNotificationListener} to receive a set of notifications. As with
*/
// FIXME: Java 8: provide a default implementation of this method.
<T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(
- @Nonnull T listener, SchemaPath... types);
+ @NonNull T listener, SchemaPath... types);
}
import java.util.Collection;
import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* An {@link EventListener} used to track RPC implementations becoming (un)available a {@link DOMRpcService}. Note that
*
* @param rpcs RPC types newly available
*/
- void onRpcAvailable(@Nonnull Collection<DOMRpcIdentifier> rpcs);
+ void onRpcAvailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
/**
* Method invoked whenever an RPC type becomes unavailable.
*
* @param rpcs RPC types which became unavailable
*/
- void onRpcUnavailable(@Nonnull Collection<DOMRpcIdentifier> rpcs);
+ void onRpcUnavailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
/**
* Implementation filtering method. This method is useful for forwarding RPC implementations,
*/
package org.opendaylight.controller.md.sal.dom.api;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
import java.util.Objects;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
public abstract class DOMRpcIdentifier {
private static final class Global extends DOMRpcIdentifier {
- private Global(final @Nonnull SchemaPath type) {
+ private Global(final @NonNull SchemaPath type) {
super(type);
}
private static final class Local extends DOMRpcIdentifier {
private final YangInstanceIdentifier contextReference;
- private Local(final @Nonnull SchemaPath type, final @Nonnull YangInstanceIdentifier contextReference) {
+ private Local(final @NonNull SchemaPath type, final @NonNull YangInstanceIdentifier contextReference) {
super(type);
- this.contextReference = Preconditions.checkNotNull(contextReference);
+ this.contextReference = requireNonNull(contextReference);
}
@Override
private final SchemaPath type;
private DOMRpcIdentifier(final SchemaPath type) {
- this.type = Preconditions.checkNotNull(type);
+ this.type = requireNonNull(type);
}
/**
* @param type RPC type, SchemaPath of its definition, may not be null
* @return A global RPC identifier, guaranteed to be non-null.
*/
- public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type) {
+ public static @NonNull DOMRpcIdentifier create(final @NonNull SchemaPath type) {
return new Global(type);
}
* @param contextReference Context reference, null means a global RPC identifier.
* @return A global RPC identifier, guaranteed to be non-null.
*/
- public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type,
+ public static @NonNull DOMRpcIdentifier create(final @NonNull SchemaPath type,
final @Nullable YangInstanceIdentifier contextReference) {
if (contextReference == null || contextReference.isEmpty()) {
return new Global(type);
*
* @return RPC type.
*/
- public final @Nonnull SchemaPath getType() {
+ public final @NonNull SchemaPath getType() {
return type;
}
*
* @return RPC context reference.
*/
- public abstract @Nonnull YangInstanceIdentifier getContextReference();
+ public abstract @NonNull YangInstanceIdentifier getContextReference();
@Override
public final int hashCode() {
package org.opendaylight.controller.md.sal.dom.api;
import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* or report a subclass of {@link DOMRpcException} reporting a transport
* error.
*/
- @Nonnull CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull DOMRpcIdentifier rpc,
+ @NonNull CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@NonNull DOMRpcIdentifier rpc,
@Nullable NormalizedNode<?, ?> input);
/**
*/
package org.opendaylight.controller.md.sal.dom.api;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
/**
* Exception indicating that no implementation of the requested RPC service is available.
public class DOMRpcImplementationNotAvailableException extends DOMRpcException {
private static final long serialVersionUID = 1L;
- public DOMRpcImplementationNotAvailableException(@Nonnull final String format, final Object... args) {
+ public DOMRpcImplementationNotAvailableException(final @NonNull String format, final Object... args) {
super(String.format(format, args));
}
- public DOMRpcImplementationNotAvailableException(@Nonnull final Throwable cause, @Nonnull final String format,
+ public DOMRpcImplementationNotAvailableException(final @NonNull Throwable cause, final @NonNull String format,
final Object... args) {
- super(String.format(format, args), Preconditions.checkNotNull(cause));
+ super(String.format(format, args), requireNonNull(cause));
}
public DOMRpcImplementationNotAvailableException(final String message, final Throwable cause) {
package org.opendaylight.controller.md.sal.dom.api;
import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
/**
* A {@link DOMService} which allows registration of RPC implementations with a conceptual router. The client
* @throws NullPointerException if implementation or types is null
* @throws IllegalArgumentException if types is empty or contains a null element.
*/
- @Nonnull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
- @Nonnull T implementation, @Nonnull DOMRpcIdentifier... rpcs);
+ @NonNull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
+ @NonNull T implementation, @NonNull DOMRpcIdentifier... rpcs);
/**
* Register an {@link DOMRpcImplementation} object with this service.
* @throws NullPointerException if implementation or types is null
* @throws IllegalArgumentException if types is empty or contains a null element.
*/
- @Nonnull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
- @Nonnull T implementation, @Nonnull Set<DOMRpcIdentifier> rpcs);
+ @NonNull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
+ @NonNull T implementation, @NonNull Set<DOMRpcIdentifier> rpcs);
}
package org.opendaylight.controller.md.sal.dom.api;
import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
* or report a subclass of {@link DOMRpcException} reporting a transport
* error.
*/
- @Nonnull CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull SchemaPath type,
+ @NonNull CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@NonNull SchemaPath type,
@Nullable NormalizedNode<?, ?> input);
/**
* a {@link ListenerRegistration#close()} will cancel it. Returned object
* is guaranteed to be non-null.
*/
- @Nonnull <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@Nonnull T listener);
+ @NonNull <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@NonNull T listener);
}
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
if (treeChange) {
extensions = ImmutableMap.<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension>of(
DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
- @Nonnull
@Override
public <L extends DOMDataTreeChangeListener> ListenerRegistration<L>
- registerDataTreeChangeListener(
- @Nonnull final DOMDataTreeIdentifier treeId, @Nonnull final L listener) {
+ registerDataTreeChangeListener(final DOMDataTreeIdentifier treeId, final L listener) {
DOMStore publisher = getTxFactories().get(treeId.getDatastoreType());
checkState(publisher != null,
"Requested logical data store is not available.");
return "DOM-" + txNum.getAndIncrement();
}
- @Nonnull
@Override
public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
return extensions;
*/
package org.opendaylight.controller.md.sal.dom.broker.impl;
-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.md.sal.common.api.data.TransactionChainListener;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
*
* @param delegate Backend broker, may not be null.
*/
- public PingPongDataBroker(@Nonnull final DOMDataBroker delegate) {
- this.delegate = Preconditions.checkNotNull(delegate);
+ public PingPongDataBroker(final @NonNull DOMDataBroker delegate) {
+ this.delegate = requireNonNull(delegate);
}
@Override
*/
package org.opendaylight.controller.md.sal.dom.broker.impl;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.FutureCallback;
import java.util.Map.Entry;
import java.util.concurrent.CancellationException;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import javax.annotation.Nonnull;
import javax.annotation.concurrent.GuardedBy;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
private volatile PingPongTransaction inflightTx;
PingPongTransactionChain(final DOMDataBroker broker, final TransactionChainListener listener) {
- this.listener = Preconditions.checkNotNull(listener);
+ this.listener = requireNonNull(listener);
this.delegate = broker.createTransactionChain(new TransactionChainListener() {
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
}
private synchronized PingPongTransaction slowAllocateTransaction() {
- Preconditions.checkState(shutdownTx == null, "Transaction chain %s has been shut down", this);
+ checkState(shutdownTx == null, "Transaction chain %s has been shut down", this);
if (deadTx != null) {
throw new IllegalStateException(
* @param tx Transaction which needs processing.
*/
@GuardedBy("this")
- private void processTransaction(@Nonnull final PingPongTransaction tx) {
+ private void processTransaction(final @NonNull PingPongTransaction tx) {
if (failed) {
LOG.debug("Cancelling transaction {}", tx);
tx.getTransaction().cancel();
*/
private synchronized void processNextTransaction(final PingPongTransaction tx) {
final boolean success = INFLIGHT_UPDATER.compareAndSet(this, tx, null);
- Preconditions.checkState(success, "Completed transaction %s while %s was submitted", tx, inflightTx);
+ checkState(success, "Completed transaction %s while %s was submitted", tx, inflightTx);
final PingPongTransaction nextTx = READY_UPDATER.getAndSet(this, null);
if (nextTx != null) {
processNextTransaction(tx);
}
- void readyTransaction(@Nonnull final PingPongTransaction tx) {
+ void readyTransaction(final @NonNull PingPongTransaction tx) {
// First mark the transaction as not locked.
final boolean lockedMatch = LOCKED_UPDATER.compareAndSet(this, tx, null);
- Preconditions.checkState(lockedMatch, "Attempted to submit transaction %s while we have %s", tx, lockedTx);
+ checkState(lockedMatch, "Attempted to submit transaction %s while we have %s", tx, lockedTx);
LOG.debug("Transaction {} unlocked", tx);
/*
* or a background transaction completion callback.
*/
final boolean success = READY_UPDATER.compareAndSet(this, null, tx);
- Preconditions.checkState(success, "Transaction %s collided on ready state", tx, readyTx);
+ checkState(success, "Transaction %s collided on ready state", tx, readyTx);
LOG.debug("Transaction {} readied", tx);
/*
synchronized void cancelTransaction(final PingPongTransaction tx, final DOMDataReadWriteTransaction frontendTx) {
// Attempt to unlock the operation.
final boolean lockedMatch = LOCKED_UPDATER.compareAndSet(this, tx, null);
- Verify.verify(lockedMatch, "Cancelling transaction %s collided with locked transaction %s", tx, lockedTx);
+ verify(lockedMatch, "Cancelling transaction %s collided with locked transaction %s", tx, lockedTx);
// Cancel the backend transaction, so we do not end up leaking it.
final boolean backendCancelled = tx.getTransaction().cancel();
@Override
public synchronized void close() {
final PingPongTransaction notLocked = lockedTx;
- Preconditions
- .checkState(notLocked == null, "Attempted to close chain with outstanding transaction %s", notLocked);
+ checkState(notLocked == null, "Attempted to close chain with outstanding transaction %s", notLocked);
// This is not reliable, but if we observe it to be null and the process has already completed,
// the backend transaction chain will throw the appropriate error.
- Preconditions.checkState(shutdownTx == null, "Attempted to close an already-closed chain");
+ checkState(shutdownTx == null, "Attempted to close an already-closed chain");
// This may be a reaction to our failure callback, in that case the backend is already shutdown
if (deadTx != 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
*/
-
package org.opendaylight.controller.md.sal.dom.broker.impl.jmx;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
import org.opendaylight.yangtools.util.DurationStatisticsTracker;
* @param commitStatsTracker the DurationStatsTracker used to obtain the stats.
* @param mbeantype mBeanType Used as the <code>type</code> property in the bean's ObjectName.
*/
- public CommitStatsMXBeanImpl(@Nonnull DurationStatisticsTracker commitStatsTracker,
- @Nonnull String mbeantype) {
+ public CommitStatsMXBeanImpl(@NonNull DurationStatisticsTracker commitStatsTracker,
+ @NonNull String mbeantype) {
super("CommitStats", mbeantype, null);
this.commitStatsTracker = commitStatsTracker;
}
* 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.md.sal.dom.broker.impl.legacy.sharded.adapter;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
listener);
}
- @Nonnull
@Override
public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
return Collections.emptyMap();
* 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.md.sal.dom.broker.impl.legacy.sharded.adapter;
-import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.SettableFuture;
import java.util.Map;
import java.util.Queue;
-import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
ShardedDOMDataBrokerDelegatingReadWriteTransaction(final Object readWriteTxId, final SchemaContext ctx,
final DOMDataReadOnlyTransaction readTxDelegate,
final DOMDataWriteTransaction writeTxDelegate) {
- this.readTxDelegate = checkNotNull(readTxDelegate);
- this.writeTxDelegate = checkNotNull(writeTxDelegate);
- this.txIdentifier = checkNotNull(readWriteTxId);
+ this.readTxDelegate = requireNonNull(readTxDelegate);
+ this.writeTxDelegate = requireNonNull(writeTxDelegate);
+ this.txIdentifier = requireNonNull(readWriteTxId);
this.initialReadMap = Maps.newEnumMap(LogicalDatastoreType.class);
final InMemoryDataTreeFactory treeFactory = new InMemoryDataTreeFactory();
final Queue<Modification> currentHistory = Lists.newLinkedList(modificationHistoryMap.get(store));
Futures.addCallback(initialReadMap.get(store), new FutureCallback<Optional<NormalizedNode<?, ?>>>() {
@Override
- public void onSuccess(@Nonnull final Optional<NormalizedNode<?, ?>> result) {
+ public void onSuccess(final Optional<NormalizedNode<?, ?>> result) {
final DataTreeModification mod = snapshotMap.get(store).newModification();
if (result.isPresent()) {
mod.write(path, result.get());
Modification(final Operation operation, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
this.data = data;
- this.path = checkNotNull(path);
- this.operation = checkNotNull(operation);
+ this.path = requireNonNull(path);
+ this.operation = requireNonNull(operation);
}
Operation getOperation() {
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
}
@Override
- public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+ public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
receivedChanges.add(changes);
latch.countDown();
}
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.md.sal.dom.api.DOMEvent;
receivedNotification.set(notification);
}
- void verifyReceived(final SchemaPath path, final ContainerNode body, @Nullable final Date eventTime)
+ void verifyReceived(final SchemaPath path, final ContainerNode body, final @Nullable Date eventTime)
throws InterruptedException, ExecutionException, TimeoutException {
final DOMNotification actual = receivedNotification.get(5, TimeUnit.SECONDS);
assertEquals(path, actual.getType());
receivedNotification.set(notification);
}
- void verifyReceived(final SchemaPath path, final ContainerNode body, @Nullable final Instant eventTime)
+ void verifyReceived(final SchemaPath path, final ContainerNode body, final @Nullable Instant eventTime)
throws InterruptedException, ExecutionException, TimeoutException {
final org.opendaylight.mdsal.dom.api.DOMNotification actual =
receivedNotification.get(5, TimeUnit.SECONDS);
import static java.util.Objects.requireNonNull;
import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ClassToInstanceMap;
import com.google.common.collect.ForwardingObject;
import com.google.common.collect.ImmutableClassToInstanceMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.MappingCheckedFuture;
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
import org.opendaylight.controller.md.sal.common.api.data.DataStoreUnavailableException;
private final DOMDataTreeWriteTransaction writeDelegate;
private final Object identifier;
- DOMDataTransactionAdapter(@Nonnull final DOMDataTreeReadTransaction readDelegate) {
- this.readDelegate = Preconditions.checkNotNull(readDelegate);
+ DOMDataTransactionAdapter(final @NonNull DOMDataTreeReadTransaction readDelegate) {
+ this.readDelegate = requireNonNull(readDelegate);
this.identifier = readDelegate.getIdentifier();
this.writeDelegate = null;
}
- DOMDataTransactionAdapter(@Nonnull final DOMDataTreeWriteTransaction writeDelegate) {
- this.writeDelegate = Preconditions.checkNotNull(writeDelegate);
+ DOMDataTransactionAdapter(final @NonNull DOMDataTreeWriteTransaction writeDelegate) {
+ this.writeDelegate = requireNonNull(writeDelegate);
this.identifier = writeDelegate.getIdentifier();
this.readDelegate = null;
}
- DOMDataTransactionAdapter(@Nonnull final DOMDataTreeReadWriteTransaction rwDelegate) {
- this.readDelegate = Preconditions.checkNotNull(rwDelegate);
+ DOMDataTransactionAdapter(final @NonNull DOMDataTreeReadWriteTransaction rwDelegate) {
+ this.readDelegate = requireNonNull(rwDelegate);
this.writeDelegate = rwDelegate;
this.identifier = readDelegate.getIdentifier();
}
*/
package org.opendaylight.controller.md.sal.dom.spi;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.yang.common.RpcError;
}
public DefaultDOMRpcResult(final NormalizedNode<?, ?> result) {
- this(result, Collections.<RpcError>emptyList());
+ this(result, Collections.emptyList());
}
public DefaultDOMRpcResult(final NormalizedNode<?, ?> result,
- final @Nonnull Collection<? extends RpcError> errors) {
+ final @NonNull Collection<? extends RpcError> errors) {
this.result = result;
- this.errors = Preconditions.checkNotNull(errors);
+ this.errors = requireNonNull(errors);
}
- public DefaultDOMRpcResult(final @Nonnull Collection<RpcError> errors) {
+ public DefaultDOMRpcResult(final @NonNull Collection<RpcError> errors) {
this(null, errors);
}
@Override
- public @Nonnull Collection<? extends RpcError> getErrors() {
+ public Collection<? extends RpcError> getErrors() {
return errors;
}
import com.google.common.collect.ForwardingObject;
import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
*/
public abstract class ForwardingDOMDataBroker extends ForwardingObject implements DOMDataBroker {
@Override
- protected abstract @Nonnull DOMDataBroker delegate();
+ protected abstract @NonNull DOMDataBroker delegate();
@Override
public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
import com.google.common.base.Optional;
import com.google.common.collect.ForwardingObject;
import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
public abstract class ForwardingDOMDataReadOnlyTransaction extends ForwardingObject
implements DOMDataReadOnlyTransaction {
@Override
- protected abstract @Nonnull DOMDataReadOnlyTransaction delegate();
+ protected abstract @NonNull DOMDataReadOnlyTransaction delegate();
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
import com.google.common.collect.ForwardingObject;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FluentFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
public abstract class ForwardingDOMDataReadWriteTransaction extends ForwardingObject
implements DOMDataReadWriteTransaction {
@Override
- protected abstract @Nonnull DOMDataReadWriteTransaction delegate();
+ protected abstract @NonNull DOMDataReadWriteTransaction delegate();
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
import com.google.common.collect.ForwardingObject;
import com.google.common.util.concurrent.FluentFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.common.api.CommitInfo;
*/
public abstract class ForwardingDOMDataWriteTransaction extends ForwardingObject implements DOMDataWriteTransaction {
@Override
- protected abstract @Nonnull DOMDataWriteTransaction delegate();
+ protected abstract @NonNull DOMDataWriteTransaction delegate();
@Override
public Object getIdentifier() {
import com.google.common.collect.ForwardingObject;
import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
*/
public abstract class ForwardingDOMRpcImplementation extends ForwardingObject implements DOMRpcImplementation {
@Override
- protected abstract @Nonnull DOMRpcImplementation delegate();
+ protected abstract @NonNull DOMRpcImplementation delegate();
@Override
public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier type,
import com.google.common.collect.ForwardingObject;
import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistration;
*/
public abstract class ForwardingDOMRpcProviderService extends ForwardingObject implements DOMRpcProviderService {
@Override
- protected abstract @Nonnull DOMRpcProviderService delegate();
+ protected abstract @NonNull DOMRpcProviderService delegate();
@Override
public <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
import com.google.common.collect.ForwardingObject;
import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
*/
public abstract class ForwardingDOMRpcResult extends ForwardingObject implements DOMRpcResult {
@Override
- protected abstract @Nonnull DOMRpcResult delegate();
+ protected abstract @NonNull DOMRpcResult delegate();
@Override
public Collection<? extends RpcError> getErrors() {
import com.google.common.collect.ForwardingObject;
import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
*/
public abstract class ForwardingDOMRpcService extends ForwardingObject implements DOMRpcService {
@Override
- protected abstract @Nonnull DOMRpcService delegate();
+ protected abstract @NonNull DOMRpcService delegate();
@Override
public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final SchemaPath type,
package org.opendaylight.controller.md.sal.dom.spi;
import com.google.common.collect.ForwardingObject;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
*/
public abstract class ForwardingDOMTransactionChain extends ForwardingObject implements DOMTransactionChain {
@Override
- protected abstract @Nonnull DOMTransactionChain delegate();
+ protected abstract @NonNull DOMTransactionChain delegate();
@Override
public void close() {
*/
package org.opendaylight.controller.sal.core.spi.data;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
/**
* Abstract DOM Store Transaction.
@Beta
public abstract class AbstractDOMStoreTransaction<T> implements DOMStoreTransaction {
private final Throwable debugContext;
- private final T identifier;
+ private final @NonNull T identifier;
- protected AbstractDOMStoreTransaction(@Nonnull final T identifier) {
+ protected AbstractDOMStoreTransaction(final @NonNull T identifier) {
this(identifier, false);
}
- protected AbstractDOMStoreTransaction(@Nonnull final T identifier, final boolean debug) {
- this.identifier = Preconditions.checkNotNull(identifier, "Identifier must not be null.");
+ protected AbstractDOMStoreTransaction(final @NonNull T identifier, final boolean debug) {
+ this.identifier = requireNonNull(identifier, "Identifier must not be null.");
this.debugContext = debug ? new Throwable().fillInStackTrace() : null;
}
/**
* Return the context in which this transaction was allocated.
*
- * @return The context in which this transaction was allocated, or null
- * if the context was not recorded.
+ * @return The context in which this transaction was allocated, or null if the context was not recorded.
*/
- @Nullable
- public final Throwable getDebugContext() {
+ public final @Nullable Throwable getDebugContext() {
return debugContext;
}
* ToStringHelper instance
* @return ToStringHelper instance which was passed in
*/
- protected ToStringHelper addToStringAttributes(@Nonnull final ToStringHelper toStringHelper) {
+ protected ToStringHelper addToStringAttributes(final @NonNull ToStringHelper toStringHelper) {
return toStringHelper.add("id", identifier);
}
}
import java.util.Collection;
import java.util.List;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.controller.md.sal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
import org.opendaylight.mdsal.dom.spi.AbstractRegistrationTree;
* @param path Path of changed candidate node. Guaranteed to match the path specified by the registration
* @param node Candidate node
*/
- protected abstract void notifyListeners(@Nonnull Collection<AbstractDOMDataTreeChangeListenerRegistration<?>>
- registrations, @Nonnull YangInstanceIdentifier path, @Nonnull DataTreeCandidateNode node);
+ protected abstract void notifyListeners(@NonNull Collection<AbstractDOMDataTreeChangeListenerRegistration<?>>
+ registrations, @NonNull YangInstanceIdentifier path, @NonNull DataTreeCandidateNode node);
/**
* Callback notifying the subclass that the specified registration is being closed and it's user no longer
*
* @param registration Registration which is being closed
*/
- protected abstract void registrationRemoved(@Nonnull AbstractDOMDataTreeChangeListenerRegistration<?> registration);
+ protected abstract void registrationRemoved(@NonNull AbstractDOMDataTreeChangeListenerRegistration<?> registration);
/**
* Process a candidate tree with respect to registered listeners.
*
* @param candidate candidate three which needs to be processed
*/
- protected final void processCandidateTree(@Nonnull final DataTreeCandidate candidate) {
+ protected final void processCandidateTree(final @NonNull DataTreeCandidate candidate) {
final DataTreeCandidateNode node = candidate.getRootNode();
if (node.getModificationType() == ModificationType.UNMODIFIED) {
LOG.debug("Skipping unmodified candidate {}", candidate);
*/
package org.opendaylight.controller.sal.core.spi.data;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
* your listener using {@link ListenerRegistration#close()} to stop
* delivery of change events.
*/
- @Nonnull <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
- @Nonnull YangInstanceIdentifier treeId, @Nonnull L listener);
+ <L extends DOMDataTreeChangeListener> @NonNull ListenerRegistration<L> registerTreeChangeListener(
+ @NonNull YangInstanceIdentifier treeId, @NonNull L listener);
}
import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
package org.opendaylight.controller.sal.core.spi.data.statistics;
import java.util.concurrent.ExecutorService;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager;
/**
*
* @param dclExecutor the executor
*/
- void setDataChangeListenerExecutor(@Nonnull ExecutorService dclExecutor);
+ void setDataChangeListenerExecutor(@NonNull ExecutorService dclExecutor);
/**
* Sets the executor used internally by the data store.
*
* @param dsExecutor the executor
*/
- void setDataStoreExecutor(@Nonnull ExecutorService dsExecutor);
+ void setDataStoreExecutor(@NonNull ExecutorService dsExecutor);
/**
* Sets the QueuedNotificationManager use for DataChangeListener notifications.
*
* @param manager the manager
*/
- void setNotificationManager(@Nonnull QueuedNotificationManager<?, ?> manager);
+ void setNotificationManager(@NonNull QueuedNotificationManager<?, ?> manager);
}
package org.opendaylight.controller.md.sal.dom.store.impl;
import java.util.concurrent.ExecutorService;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
private InMemoryDOMDataStoreFactory() {
}
- public static InMemoryDOMDataStore create(final String name,
- @Nullable final DOMSchemaService schemaService) {
+ public static InMemoryDOMDataStore create(final String name, final @Nullable DOMSchemaService schemaService) {
return create(name, schemaService, null);
}
* default property values are used.
* @return an InMemoryDOMDataStore instance
*/
- public static InMemoryDOMDataStore create(final String name,
- @Nullable final DOMSchemaService schemaService,
- @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
+ public static InMemoryDOMDataStore create(final String name, final @Nullable DOMSchemaService schemaService,
+ final @Nullable InMemoryDOMDataStoreConfigProperties properties) {
return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, false, properties);
}
* @return an InMemoryDOMDataStore instance
*/
public static InMemoryDOMDataStore create(final String name, final LogicalDatastoreType type,
- @Nullable final DOMSchemaService schemaService, final boolean debugTransactions,
- @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
+ final @Nullable DOMSchemaService schemaService, final boolean debugTransactions,
+ final @Nullable InMemoryDOMDataStoreConfigProperties properties) {
InMemoryDOMDataStoreConfigProperties actualProperties = properties;
if (actualProperties == null) {
import java.util.Collections;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.controller.md.sal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
import org.opendaylight.controller.sal.core.spi.data.AbstractDOMStoreTreeChangePublisher;
return reg;
}
- synchronized void publishChange(@Nonnull final DataTreeCandidate candidate) {
+ synchronized void publishChange(final @NonNull DataTreeCandidate candidate) {
// Runs synchronized with registrationRemoved()
processCandidateTree(candidate);
}
*/
package org.opendaylight.controller.remote.rpc;
+import static java.util.Objects.requireNonNull;
+
import akka.dispatch.OnComplete;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.AbstractFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
import org.opendaylight.mdsal.dom.api.DOMRpcException;
import org.opendaylight.mdsal.dom.api.DOMRpcResult;
private final QName rpcName;
private RemoteDOMRpcFuture(final QName rpcName) {
- this.rpcName = Preconditions.checkNotNull(rpcName, "rpcName");
+ this.rpcName = requireNonNull(rpcName, "rpcName");
}
public static RemoteDOMRpcFuture create(final QName rpcName) {
}
@Override
- public DOMRpcResult get(final long timeout, @Nonnull final TimeUnit unit)
+ public DOMRpcResult get(final long timeout, final TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
try {
return super.get(timeout, unit);
*/
package org.opendaylight.controller.remote.rpc;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
import java.util.Collection;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.RemoveRoutes;
private final ActorRef rpcRegistry;
RpcListener(final ActorRef rpcRegistry) {
- this.rpcRegistry = Preconditions.checkNotNull(rpcRegistry);
+ this.rpcRegistry = requireNonNull(rpcRegistry);
}
@Override
- public void onRpcAvailable(@Nonnull final Collection<DOMRpcIdentifier> rpcs) {
- Preconditions.checkArgument(rpcs != null, "Input Collection of DOMRpcIdentifier can not be null.");
+ public void onRpcAvailable(final Collection<DOMRpcIdentifier> rpcs) {
+ checkArgument(rpcs != null, "Input Collection of DOMRpcIdentifier can not be null.");
LOG.debug("Adding registration for [{}]", rpcs);
rpcRegistry.tell(new AddOrUpdateRoutes(rpcs), ActorRef.noSender());
}
@Override
- public void onRpcUnavailable(@Nonnull final Collection<DOMRpcIdentifier> rpcs) {
- Preconditions.checkArgument(rpcs != null, "Input Collection of DOMRpcIdentifier can not be null.");
+ public void onRpcUnavailable(final Collection<DOMRpcIdentifier> rpcs) {
+ checkArgument(rpcs != null, "Input Collection of DOMRpcIdentifier can not be null.");
LOG.debug("Removing registration for [{}]", rpcs);
rpcRegistry.tell(new RemoveRoutes(rpcs), ActorRef.noSender());
*/
package org.opendaylight.controller.remote.rpc.messages;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
-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.node.utils.stream.SerializationUtils;
import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
import org.opendaylight.yangtools.yang.common.QName;
private final NormalizedNode<?, ?> inputNormalizedNode;
private final QName rpc;
- private ExecuteRpc(@Nullable final NormalizedNode<?, ?> inputNormalizedNode, @Nonnull final QName rpc) {
- this.rpc = Preconditions.checkNotNull(rpc, "rpc Qname should not be null");
+ private ExecuteRpc(final @Nullable NormalizedNode<?, ?> inputNormalizedNode, final @NonNull QName rpc) {
+ this.rpc = requireNonNull(rpc, "rpc Qname should not be null");
this.inputNormalizedNode = inputNormalizedNode;
}
- public static ExecuteRpc from(@Nonnull final DOMRpcIdentifier rpc, @Nullable final NormalizedNode<?, ?> input) {
+ public static ExecuteRpc from(final @NonNull DOMRpcIdentifier rpc, final @Nullable NormalizedNode<?, ?> input) {
return new ExecuteRpc(input, rpc.getType().getLastComponent());
}
- @Nullable
- public NormalizedNode<?, ?> getInputNormalizedNode() {
+ public @Nullable NormalizedNode<?, ?> getInputNormalizedNode() {
return inputNormalizedNode;
}
- @Nonnull
- public QName getRpc() {
+ public @NonNull QName getRpc() {
return rpc;
}
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+ "aren't serialized. FindBugs does not recognize this.")
private final NormalizedNode<?, ?> resultNormalizedNode;
- public RpcResponse(@Nullable final NormalizedNode<?, ?> inputNormalizedNode) {
+ public RpcResponse(final @Nullable NormalizedNode<?, ?> inputNormalizedNode) {
resultNormalizedNode = inputNormalizedNode;
}
- @Nullable
- public NormalizedNode<?, ?> getResultNormalizedNode() {
+ public @Nullable NormalizedNode<?, ?> getResultNormalizedNode() {
return resultNormalizedNode;
}
import akka.actor.ActorRef;
import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
public interface Bucket<T extends BucketData<T>> {
long getVersion();
- @Nonnull T getData();
+ @NonNull T getData();
default Optional<ActorRef> getWatchActor() {
return getData().getWatchActor();
*/
package org.opendaylight.controller.remote.rpc.registry.gossip;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
+import static com.google.common.base.Verify.verifyNotNull;
+import static java.util.Objects.requireNonNull;
+
import java.io.Serializable;
final class BucketImpl<T extends BucketData<T>> implements Bucket<T>, Serializable {
BucketImpl(final long version, final T data) {
this.version = version;
- this.data = Preconditions.checkNotNull(data);
+ this.data = requireNonNull(data);
}
@Override
}
private Object readResolve() {
- Verify.verifyNotNull(data);
+ verifyNotNull(data);
return 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
*/
-
package org.opendaylight.controller.clustering.it.provider;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
private static final Logger LOG = LoggerFactory.getLogger(CarDataTreeChangeListener.class);
@java.lang.Override
- public void onDataTreeChanged(@Nonnull final java.util.Collection<DataTreeModification<Cars>> changes) {
+ public void onDataTreeChanged(final java.util.Collection<DataTreeModification<Cars>> changes) {
if (LOG.isTraceEnabled()) {
for (DataTreeModification<Cars> change : changes) {
ouputChanges(change);
* 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.clustering.it.provider.impl;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
return rpcProviderService.registerRpcImplementation(new GetConstantService(constant), id);
}
- @Nonnull
@Override
- public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
- @Nullable final NormalizedNode<?, ?> input) {
+ public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc,
+ final NormalizedNode<?, ?> input) {
LOG.debug("get-constant invoked, current value: {}", constant);
final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()
* 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.clustering.it.provider.impl;
import com.google.common.base.Preconditions;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.mdsal.dom.api.DOMDataTreeListener;
import org.opendaylight.mdsal.dom.api.DOMDataTreeListeningException;
private ScheduledExecutorService executorService;
@Override
- public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes,
- @Nonnull final Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>> subtrees) {
+ public void onDataTreeChanged(final Collection<DataTreeCandidate> changes,
+ final Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>> subtrees) {
// There should only be one candidate reported
Preconditions.checkState(changes.size() == 1);
}
@Override
- public void onDataTreeFailed(@Nonnull Collection<DOMDataTreeListeningException> causes) {
+ public void onDataTreeFailed(Collection<DOMDataTreeListeningException> causes) {
}
* 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.clustering.it.provider.impl;
import static org.opendaylight.controller.clustering.it.provider.impl.AbstractTransactionHandler.ITEM;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
private ScheduledFuture<?> scheduledFuture;
@Override
- public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+ public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
// There should only be one candidate reported
Preconditions.checkState(changes.size() == 1);
* 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.clustering.it.provider.impl;
import static org.opendaylight.controller.clustering.it.provider.impl.AbstractTransactionHandler.ID;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import java.util.stream.Collectors;
-import javax.annotation.Nullable;
import org.opendaylight.controller.cluster.access.concepts.MemberName;
import org.opendaylight.controller.cluster.sharding.DistributedShardFactory;
import org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration;
final ListenableFuture<?> ensureFuture = ensureListExists();
Futures.addCallback(ensureFuture, new FutureCallback<Object>() {
@Override
- public void onSuccess(@Nullable final Object result) {
+ public void onSuccess(final Object result) {
LOG.debug("Initial list write successful.");
future.set(RpcResultBuilder.success(new CreatePrefixShardOutputBuilder().build()).build());
}
final ListenableFuture<?> future = tx.commit();
Futures.addCallback(future, new FutureCallback<Object>() {
@Override
- public void onSuccess(@Nullable final Object result) {
+ public void onSuccess(final Object result) {
try {
LOG.debug("Closing producer for initial list.");
producer.close();
* 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.clustering.it.provider.impl;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
return rpcProviderService.registerRpcImplementation(new RoutedGetConstantService(constant), id);
}
- @Nonnull
@Override
- public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
- @Nullable final NormalizedNode<?, ?> input) {
+ public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc,
+ final NormalizedNode<?, ?> input) {
LOG.debug("get-contexted-constant invoked, current value: {}", constant);
final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()
* 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.clustering.it.provider.impl;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
.registerClusterSingletonService(new SingletonGetConstantService(rpcProviderService, constant));
}
- @Nonnull
@Override
- public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull DOMRpcIdentifier rpc,
- @Nullable NormalizedNode<?, ?> input) {
+ public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(DOMRpcIdentifier rpc,
+ NormalizedNode<?, ?> input) {
LOG.debug("get-singleton-constant invoked, current value: {}", constant);
final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()