This API is no longer @Beta.
Change-Id: If81e77c8b2c9dc2fcfa6bcd94f58426c75f6cd0a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import static com.google.common.base.Preconditions.checkArgument;
-import com.google.common.annotations.Beta;
import com.google.common.annotations.VisibleForTesting;
import java.io.DataInput;
import java.io.DataOutput;
/**
* Enumeration of all ABI versions supported by this implementation of the client access API.
- *
- * @author Robert Varga
*/
-@Beta
public enum ABIVersion implements WritableObject {
// NOTE: enumeration values need to be sorted in ascending order of their version to keep Comparable working
* @throws PastVersionException if the specified integer identifies a past version which is no longer supported
*/
public static @NonNull ABIVersion valueOf(final short value) throws FutureVersionException, PastVersionException {
- switch (Short.toUnsignedInt(value)) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- throw new PastVersionException(value, BORON);
- case 5:
- return BORON;
- case 6:
- return NEON_SR2;
- case 7:
- return SODIUM_SR1;
- case 8:
- return MAGNESIUM;
- default:
- throw new FutureVersionException(value, MAGNESIUM);
- }
+ return switch (Short.toUnsignedInt(value)) {
+ case 0, 1, 2, 3, 4 -> throw new PastVersionException(value, BORON);
+ case 5 -> BORON;
+ case 6 -> NEON_SR2;
+ case 7 -> SODIUM_SR1;
+ case 8 -> MAGNESIUM;
+ default -> throw new FutureVersionException(value, MAGNESIUM);
+ };
}
@Override
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
/**
* Abstract base exception used for reporting version mismatches from {@link ABIVersion}.
- *
- * @author Robert Varga
*/
-@Beta
public abstract class AbstractVersionException extends Exception {
+ @Serial
private static final long serialVersionUID = 1L;
+
private final @NonNull ABIVersion closestVersion;
private final int version;
*
* @return Numeric version
*/
- public final int getVersion() {
+ public final int version() {
return version;
}
*
* @return Closest supported {@link ABIVersion}
*/
- public final @NonNull ABIVersion getClosestVersion() {
+ public final @NonNull ABIVersion closestVersion() {
return closestVersion;
}
-
}
*/
package org.opendaylight.controller.cluster.access;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
/**
* Exception thrown from {@link ABIVersion#valueOf(short)} when the specified version is too new to be supported
* by the codebase.
- *
- * @author Robert Varga
*/
-@Beta
public final class FutureVersionException extends AbstractVersionException {
+ @Serial
private static final long serialVersionUID = 1L;
FutureVersionException(final short version, ABIVersion closest) {
*/
package org.opendaylight.controller.cluster.access;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
/**
* Exception thrown from {@link ABIVersion#valueOf(short)} when the specified version is too old and no longer
*
* @author Robert Varga
*/
-@Beta
public final class PastVersionException extends AbstractVersionException {
+ @Serial
private static final long serialVersionUID = 1L;
PastVersionException(final short version, final ABIVersion closest) {
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
* Request to abort a local transaction. Since local transactions do not introduce state on the backend until they
* are ready, the purpose of this message is to inform the backend that a message identifier has been used. This is
* not important for single transactions, but is critical to ensure transaction ordering within local histories.
- *
- * @author Robert Varga
*/
-@Beta
public final class AbortLocalTransactionRequest extends AbstractLocalTransactionRequest<AbortLocalTransactionRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public AbortLocalTransactionRequest(final @NonNull TransactionIdentifier identifier,
import static java.util.Objects.requireNonNull;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
* This class is visible outside of this package for the purpose of allowing common instanceof checks
* and simplified codepaths.
*
- * @author Robert Varga
- *
* @param <T> Message type
*/
-@Beta
public abstract class AbstractReadPathTransactionRequest<T extends AbstractReadPathTransactionRequest<T>>
extends AbstractReadTransactionRequest<T> {
+ @Serial
private static final long serialVersionUID = 1L;
private final @NonNull YangInstanceIdentifier path;
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
* This class is visible outside of this package for the purpose of allowing common instanceof checks
* and simplified codepaths.
*
- * @author Robert Varga
- *
* @param <T> Message type
*/
-@Beta
public abstract class AbstractReadTransactionRequest<T extends AbstractReadTransactionRequest<T>>
extends TransactionRequest<T> {
+ @Serial
private static final long serialVersionUID = 1L;
private final boolean snapshotOnly;
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
/**
* been closed, either via a successful commit or abort (which is indicated via {@link #isSuccessful()}. This can
* happen if the corresponding journal record is replicated, but the message to the frontend gets lost and the backed
* leader moved before the frontend retried the corresponding request.
- *
- * @author Robert Varga
*/
-@Beta
public final class ClosedTransactionException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
private final boolean successful;
import static java.util.Objects.requireNonNull;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.io.Serial;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
/**
* Request to commit a local transaction. Since local transactions do not introduce state on the backend until they
* are ready, this message carries a complete set of modifications.
- *
- * @author Robert Varga
*/
-@Beta
public final class CommitLocalTransactionRequest
extends AbstractLocalTransactionRequest<CommitLocalTransactionRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
@SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.AbstractRequestFailureProxy;
import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
/**
* A {@link RequestFailure} reported when {@link ConnectClientRequest} fails.
- *
- * @author Robert Varga
*/
-@Beta
public final class ConnectClientFailure extends RequestFailure<ClientIdentifier, ConnectClientFailure> {
+ @Serial
private static final long serialVersionUID = 1L;
ConnectClientFailure(final ClientIdentifier target, final long sequence, final RequestException cause) {
import static java.util.Objects.requireNonNull;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.AbstractRequestProxy;
*
* <p>
* It also includes request stream sequencing information.
- *
- * @author Robert Varga
*/
-@Beta
public final class ConnectClientRequest extends Request<ClientIdentifier, ConnectClientRequest> {
private static final long serialVersionUID = 1L;
private ConnectClientRequest(final ConnectClientRequest request, final ABIVersion version) {
super(request, version);
- this.minVersion = request.minVersion;
- this.maxVersion = request.maxVersion;
+ minVersion = request.minVersion;
+ maxVersion = request.maxVersion;
}
public ABIVersion getMinVersion() {
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.collect.ImmutableList;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
* Successful reply to an {@link ConnectClientRequest}. Client actor which initiated this connection should use
* the version reported via {@link #getVersion()} of this message to communicate with this backend. Should this backend
* fail, the client can try accessing the provided alternates.
- *
- * @author Robert Varga
*/
-@Beta
public final class ConnectClientSuccess extends RequestSuccess<ClientIdentifier, ConnectClientSuccess> {
private static final long serialVersionUID = 1L;
- @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 @NonNull List<ActorSelection> alternates;
+ private final @NonNull ImmutableList<ActorSelection> alternates;
@SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "See justification above.")
private final ReadOnlyDataTree dataTree;
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
/**
* Request to create a new local history.
- *
- * @author Robert Varga
*/
-@Beta
public final class CreateLocalHistoryRequest extends LocalHistoryRequest<CreateLocalHistoryRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public CreateLocalHistoryRequest(final LocalHistoryIdentifier target, final ActorRef replyTo) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
import com.google.common.collect.RangeSet;
import com.google.common.primitives.UnsignedLong;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
/**
* A {@link RequestException} indicating that the backend has received a request to create a history which has already
* been retired.
- *
- * @author Robert Varga
*/
-@Beta
public final class DeadHistoryException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
public DeadHistoryException(final RangeSet<UnsignedLong> purgedHistories) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
import com.google.common.collect.ImmutableRangeSet;
import com.google.common.collect.RangeSet;
import com.google.common.primitives.UnsignedLong;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
/**
* A {@link RequestException} indicating that the backend has received a request to create a transaction which has
* already been purged.
- *
- * @author Robert Varga
*/
-@Beta
public final class DeadTransactionException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
private final RangeSet<UnsignedLong> purgedIdentifiers;
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
/**
* Request to destroy a local history.
- *
- * @author Robert Varga
*/
-@Beta
public final class DestroyLocalHistoryRequest extends LocalHistoryRequest<DestroyLocalHistoryRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public DestroyLocalHistoryRequest(final LocalHistoryIdentifier target, final long sequence,
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* A transaction request to query if a particular path exists in the current view of a particular transaction.
- *
- * @author Robert Varga
*/
-@Beta
public final class ExistsTransactionRequest extends AbstractReadPathTransactionRequest<ExistsTransactionRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public ExistsTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence,
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* Successful reply to an {@link ExistsTransactionRequest}. It indicates presence of requested data via
* {@link #getExists()}.
- *
- * @author Robert Varga
*/
-@Beta
public final class ExistsTransactionSuccess extends TransactionSuccess<ExistsTransactionSuccess> {
+ @Serial
private static final long serialVersionUID = 1L;
+
private final boolean exists;
public ExistsTransactionSuccess(final TransactionIdentifier target, final long sequence, final boolean exists) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* Successful reply to an {@link IncrementTransactionSequenceRequest}.
- *
- * @author Robert Varga
*/
-@Beta
public final class IncrementTransactionSequenceSuccess extends TransactionSuccess<IncrementTransactionSequenceSuccess> {
+ @Serial
private static final long serialVersionUID = 1L;
public IncrementTransactionSequenceSuccess(final TransactionIdentifier target, final long sequence) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
/**
* Generic {@link RequestFailure} involving a {@link LocalHistoryRequest}.
- *
- * @author Robert Varga
*/
-@Beta
public final class LocalHistoryFailure extends RequestFailure<LocalHistoryIdentifier, LocalHistoryFailure> {
+ @Serial
private static final long serialVersionUID = 1L;
LocalHistoryFailure(final LocalHistoryIdentifier target, final long sequence, final RequestException cause) {
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
import org.opendaylight.controller.cluster.access.concepts.Request;
* Abstract base class for {@link Request}s involving specific local history. This class is visible outside of this
* package solely for the ability to perform a unified instanceof check.
*
- * @author Robert Varga
- *
* @param <T> Message type
*/
-@Beta
public abstract class LocalHistoryRequest<T extends LocalHistoryRequest<T>> extends Request<LocalHistoryIdentifier, T> {
+ @Serial
private static final long serialVersionUID = 1L;
LocalHistoryRequest(final LocalHistoryIdentifier target, final long sequence, final ActorRef replyTo) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.AbstractSuccessProxy;
import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
/**
* Success class for {@link RequestSuccess}es involving a specific local history.
- *
- * @author Robert Varga
*/
-@Beta
public final class LocalHistorySuccess extends RequestSuccess<LocalHistoryIdentifier, LocalHistorySuccess> {
private static final long serialVersionUID = 1L;
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.collect.ImmutableList;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.io.Serial;
import java.util.List;
import java.util.Optional;
import org.opendaylight.controller.cluster.access.ABIVersion;
/**
* A transaction request to apply a particular set of operations on top of the current transaction. This message is
* used to also finish a transaction by specifying a {@link PersistenceProtocol}.
- *
- * @author Robert Varga
*/
-@Beta
public final class ModifyTransactionRequest extends TransactionRequest<ModifyTransactionRequest>
implements SliceableMessage {
+ @Serial
private static final long serialVersionUID = 1L;
@SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
import static java.util.Objects.requireNonNull;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
/**
* A reusable builder for creating {@link ModifyTransactionRequest} message instances. Its internal state is reset when
* {@link #build()} is invoked, hence it can be used to create a sequence of messages. This class is NOT thread-safe.
- *
- * @author Robert Varga
*/
-@Beta
public final class ModifyTransactionRequestBuilder implements Identifiable<TransactionIdentifier> {
private final List<TransactionModification> modifications = new ArrayList<>(1);
- private final TransactionIdentifier identifier;
+ private final @NonNull TransactionIdentifier identifier;
private final ActorRef replyTo;
private PersistenceProtocol protocol;
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* Response to a {@link ModifyTransactionRequest} which does not have a {@link PersistenceProtocol}.
- *
- * @author Robert Varga
*/
-@Beta
public final class ModifyTransactionSuccess extends TransactionSuccess<ModifyTransactionSuccess> {
+ @Serial
private static final long serialVersionUID = 1L;
public ModifyTransactionSuccess(final TransactionIdentifier identifier, final long sequence) {
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
/**
* General error raised when the recipient of a Request is not the correct backend to talk to. This typically
* means that the backend processing has moved and the frontend needs to run rediscovery and retry the request.
- *
- * @author Robert Varga
*/
-@Beta
public final class NotLeaderException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
public NotLeaderException(final ActorRef me) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
/**
* A {@link RequestException} indicating that the backend has received a Request whose sequence does not match the
* next expected sequence for the target. This is a hard error, as it indicates a Request is missing in the stream.
- *
- * @author Robert Varga
*/
-@Beta
public final class OutOfOrderRequestException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
public OutOfOrderRequestException(final long expectedRequest) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
/**
* A {@link RequestException} indicating that the backend has received a RequestEnvelope whose sequence does not match
* the next expected sequence. This can happen during leader transitions, when a part of the stream is rejected because
* the backend is not the leader and it transitions to being a leader with old stream messages still being present.
- *
- * @author Robert Varga
*/
-@Beta
public final class OutOfSequenceEnvelopeException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
public OutOfSequenceEnvelopeException(final long expectedEnvelope) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.concepts.WritableObject;
/**
* Enumeration of transaction persistence protocols. These govern which protocol is executed between the frontend
* and backend to drive persistence of a particular transaction.
- *
- * @author Robert Varga
*/
-@Beta
public enum PersistenceProtocol implements WritableObject {
/**
* Abort protocol. The transaction has been aborted on the frontend and its effects should not be visible
return finish == null ? 0 : finish.byteValue();
}
- static PersistenceProtocol valueOf(final byte value) {
- switch (value) {
- case 0:
- return null;
- case 1:
- return ABORT;
- case 2:
- return SIMPLE;
- case 3:
- return THREE_PHASE;
- case 4:
- return READY;
- default:
- throw new IllegalArgumentException("Unhandled byte value " + value);
- }
+ static @Nullable PersistenceProtocol valueOf(final byte value) {
+ return switch (value) {
+ case 0 -> null;
+ case 1 -> ABORT;
+ case 2 -> SIMPLE;
+ case 3 -> THREE_PHASE;
+ case 4 -> READY;
+ default -> throw new IllegalArgumentException("Unhandled byte value " + value);
+ };
}
}
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
/**
* Request to purge a local history. This request is sent by the client once it receives a successful reply to
* {@link DestroyLocalHistoryRequest} and indicates it has removed all state attached to a particular local history.
- *
- * @author Robert Varga
*/
-@Beta
public final class PurgeLocalHistoryRequest extends LocalHistoryRequest<PurgeLocalHistoryRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public PurgeLocalHistoryRequest(final LocalHistoryIdentifier target, final long sequence, final ActorRef replyTo) {
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* A transaction request to read a particular path exists in the current view of a particular transaction.
- *
- * @author Robert Varga
*/
-@Beta
public final class ReadTransactionRequest extends AbstractReadPathTransactionRequest<ReadTransactionRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public ReadTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence,
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.io.Serial;
import java.util.Optional;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.SliceableMessage;
/**
* Successful reply to an {@link ReadTransactionRequest}. It indicates presence of requested data via
* {@link #getData()}.
- *
- * @author Robert Varga
*/
-@Beta
-@SuppressFBWarnings("SE_BAD_FIELD")
public final class ReadTransactionSuccess extends TransactionSuccess<ReadTransactionSuccess>
implements SliceableMessage {
+ @Serial
private static final long serialVersionUID = 1L;
+
+ @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "interface-based best effort")
private final Optional<NormalizedNode> data;
public ReadTransactionSuccess(final TransactionIdentifier identifier, final long sequence,
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.collect.ImmutableList;
import com.google.common.primitives.UnsignedLong;
+import java.io.Serial;
import java.util.Collection;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
* This request is sent by the frontend to inform the backend that a set of {@link TransactionIdentifier}s are
* explicitly retired and are guaranteed to never be used by the frontend.
*/
-@Beta
public final class SkipTransactionsRequest extends TransactionRequest<SkipTransactionsRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
// Note: UnsignedLong is arbitrary, yang.common.Uint64 would work just as well, we really want an immutable
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* Successful reply to a {@link SkipTransactionsRequest}.
*/
-@Beta
public final class SkipTransactionsResponse extends TransactionSuccess<SkipTransactionsResponse> {
+ @Serial
private static final long serialVersionUID = 1L;
public SkipTransactionsResponse(final TransactionIdentifier identifier, final long sequence) {
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* A transaction request to perform the abort step of the three-phase commit protocol.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionAbortRequest extends TransactionRequest<TransactionAbortRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public TransactionAbortRequest(final TransactionIdentifier target, final long sequence, final ActorRef replyTo) {
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
import java.io.IOException;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* A {@link TransactionModification} which has a data component.
- *
- * @author Robert Varga
*/
-@Beta
public abstract class TransactionDataModification extends TransactionModification {
private final NormalizedNode data;
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
/**
* Delete a particular path.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionDelete extends TransactionModification {
public TransactionDelete(final YangInstanceIdentifier path) {
super(path);
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* A transaction request to perform the final, doCommit, step of the three-phase commit protocol.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionDoCommitRequest extends TransactionRequest<TransactionDoCommitRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public TransactionDoCommitRequest(final TransactionIdentifier target, final long sequence, final ActorRef replyTo) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
import org.opendaylight.controller.cluster.access.concepts.RequestFailure;
/**
* Generic {@link RequestFailure} involving a {@link TransactionRequest}.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionFailure extends RequestFailure<TransactionIdentifier, TransactionFailure> {
+ @Serial
private static final long serialVersionUID = 1L;
TransactionFailure(final TransactionIdentifier target, final long sequence, final RequestException cause) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* Merge a {@link NormalizedNode} tree onto a specific path.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionMerge extends TransactionDataModification {
public TransactionMerge(final YangInstanceIdentifier path, final NormalizedNode data) {
super(path, data);
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import java.io.IOException;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
* {@link #readFrom(NormalizedNodeDataInput, ReusableStreamReceiver)} methods for explicit serialization. The reason for
* this is that they are usually transmitted in bulk, hence it is advantageous to reuse
* a {@link NormalizedNodeDataOutput} instance to achieve better compression.
- *
- * @author Robert Varga
*/
-@Beta
public abstract class TransactionModification {
static final byte TYPE_DELETE = 1;
static final byte TYPE_MERGE = 2;
static TransactionModification readFrom(final NormalizedNodeDataInput in, final ReusableStreamReceiver writer)
throws IOException {
final byte type = in.readByte();
- switch (type) {
- case TYPE_DELETE:
- return new TransactionDelete(in.readYangInstanceIdentifier());
- case TYPE_MERGE:
- return new TransactionMerge(in.readYangInstanceIdentifier(), in.readNormalizedNode(writer));
- case TYPE_WRITE:
- return new TransactionWrite(in.readYangInstanceIdentifier(), in.readNormalizedNode(writer));
- default:
- throw new IllegalArgumentException("Unhandled type " + type);
- }
+ return switch (type) {
+ case TYPE_DELETE -> new TransactionDelete(in.readYangInstanceIdentifier());
+ case TYPE_MERGE -> new TransactionMerge(in.readYangInstanceIdentifier(), in.readNormalizedNode(writer));
+ case TYPE_WRITE -> new TransactionWrite(in.readYangInstanceIdentifier(), in.readNormalizedNode(writer));
+ default -> throw new IllegalArgumentException("Unhandled type " + type);
+ };
}
}
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
/**
* A transaction request to perform the second, preCommit, step of the three-phase commit protocol.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionPreCommitRequest extends TransactionRequest<TransactionPreCommitRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public TransactionPreCommitRequest(final TransactionIdentifier target, final long sequence,
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
* A transaction request to perform the final transaction transition, which is purging it from the protocol view,
* meaning the frontend has no further knowledge of the transaction. The backend is free to purge any state related
* to the transaction and responds with a {@link TransactionPurgeResponse}.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionPurgeRequest extends TransactionRequest<TransactionPurgeRequest> {
+ @Serial
private static final long serialVersionUID = 1L;
public TransactionPurgeRequest(final TransactionIdentifier target, final long sequence, final ActorRef replyTo) {
package org.opendaylight.controller.cluster.access.commands;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.Request;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
* Abstract base class for {@link Request}s involving specific transaction. This class is visible outside of this
* package solely for the ability to perform a unified instanceof check.
*
- * @author Robert Varga
- *
* @param <T> Message type
*/
-@Beta
public abstract class TransactionRequest<T extends TransactionRequest<T>> extends Request<TransactionIdentifier, T> {
+ @Serial
private static final long serialVersionUID = 1L;
TransactionRequest(final TransactionIdentifier identifier, final long sequence, final ActorRef replyTo) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.controller.cluster.access.concepts.RequestSuccess;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
* Abstract base class for {@link RequestSuccess}es involving specific transaction. This class is visible outside of
* this package solely for the ability to perform a unified instanceof check.
*
- * @author Robert Varga
- *
* @param <T> Message type
*/
-@Beta
public abstract class TransactionSuccess<T extends TransactionSuccess<T>>
extends RequestSuccess<TransactionIdentifier, T> {
+ @Serial
private static final long serialVersionUID = 1L;
TransactionSuccess(final TransactionIdentifier identifier, final long sequence) {
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* Modification to write (and replace) a subtree at specified path with another subtree.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionWrite extends TransactionDataModification {
public TransactionWrite(final YangInstanceIdentifier path, final NormalizedNode data) {
super(path, data);
*/
package org.opendaylight.controller.cluster.access.commands;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
/**
* A {@link RequestException} indicating that the backend has received a request referencing an unknown history. This
* typically happens when the linear history ID is newer than the highest observed {@link CreateLocalHistoryRequest}.
- *
- * @author Robert Varga
*/
-@Beta
public final class UnknownHistoryException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
public UnknownHistoryException(final Long lastSeenHistory) {
}
private static String historyToString(final Long history) {
- return history == null ? "null" : Long.toUnsignedString(history.longValue());
+ return history == null ? "null" : Long.toUnsignedString(history);
}
@Override
*/
package org.opendaylight.controller.cluster.access.concepts;
-import com.google.common.annotations.Beta;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
* Abstract Externalizable proxy for use with {@link RequestFailure} subclasses.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
*/
-@Beta
public abstract class AbstractRequestFailureProxy<T extends WritableIdentifier, C extends RequestFailure<T, C>>
extends AbstractResponseProxy<T, C> {
+ @Serial
private static final long serialVersionUID = 1L;
+
private RequestException cause;
protected AbstractRequestFailureProxy() {
import akka.actor.ActorRef;
import akka.serialization.JavaSerializer;
import akka.serialization.Serialization;
-import com.google.common.annotations.Beta;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
* Abstract Externalizable proxy for use with {@link Request} subclasses.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
*/
-@Beta
public abstract class AbstractRequestProxy<T extends WritableIdentifier, C extends Request<T, C>>
extends AbstractMessageProxy<T, C> {
+ @Serial
private static final long serialVersionUID = 1L;
+
private ActorRef replyTo;
protected AbstractRequestProxy() {
*/
package org.opendaylight.controller.cluster.access.concepts;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
* Abstract Externalizable proxy for use with {@link RequestSuccess} subclasses.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
*/
-@Beta
public abstract class AbstractSuccessProxy<T extends WritableIdentifier, C extends RequestSuccess<T, C>>
extends AbstractResponseProxy<T, C> {
+ @Serial
private static final long serialVersionUID = 1L;
protected AbstractSuccessProxy() {
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.cds.types.rev191024.ClientGeneration;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
*
* @author Robert Varga
*/
-@Beta
public final class ClientIdentifier implements WritableIdentifier {
private static final class Proxy implements Externalizable {
+ @Serial
private static final long serialVersionUID = 1L;
+
private FrontendIdentifier frontendId;
private long generation;
}
}
+ @Serial
private static final long serialVersionUID = 1L;
private final @NonNull FrontendIdentifier frontendId;
@Override
public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof ClientIdentifier)) {
- return false;
- }
-
- final ClientIdentifier other = (ClientIdentifier) obj;
- return generation == other.generation && frontendId.equals(other.frontendId);
+ return this == obj || obj instanceof ClientIdentifier other && generation == other.generation
+ && frontendId.equals(other.frontendId);
}
@Override
public String toString() {
- return MoreObjects.toStringHelper(ClientIdentifier.class).add("frontend", frontendId)
- .add("generation", Long.toUnsignedString(generation)).toString();
+ return MoreObjects.toStringHelper(ClientIdentifier.class)
+ .add("frontend", frontendId)
+ .add("generation", Long.toUnsignedString(generation))
+ .toString();
}
private Object writeReplace() {
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
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 java.io.Serial;
import java.util.Objects;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
* A cluster-wide unique identifier of a frontend type located at a cluster member.
- *
- * @author Robert Varga
*/
-@Beta
public final class FrontendIdentifier implements WritableIdentifier {
private static final class Proxy implements Externalizable {
+ @Serial
private static final long serialVersionUID = 1L;
+
private MemberName memberName;
private FrontendType clientType;
}
}
+ @Serial
private static final long serialVersionUID = 1L;
+
private final MemberName memberName;
private final FrontendType clientType;
if (this == obj) {
return true;
}
- if (!(obj instanceof FrontendIdentifier)) {
+ if (!(obj instanceof FrontendIdentifier other)) {
return false;
}
- final FrontendIdentifier other = (FrontendIdentifier) obj;
return memberName.equals(other.memberName) && clientType.equals(other.clientType);
}
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.Strings;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.Serial;
import java.nio.charset.StandardCharsets;
import java.util.regex.Pattern;
import org.eclipse.jdt.annotation.NonNull;
* An {@link Identifier} identifying a data store frontend type, which is able to access the data store backend.
* Frontend implementations need to define this identifier so that multiple clients existing on a member node can be
* discerned.
- *
- * @author Robert Varga
*/
-@Beta
public final class FrontendType implements Comparable<FrontendType>, WritableIdentifier {
private static final class Proxy implements Externalizable {
+ @Serial
private static final long serialVersionUID = 1L;
private byte[] serialized;
private static final String SIMPLE_STRING_REGEX = "^[a-zA-Z0-9-_.*+:=,!~';]+$";
private static final Pattern SIMPLE_STRING_PATTERN = Pattern.compile(SIMPLE_STRING_REGEX);
+ @Serial
private static final long serialVersionUID = 1L;
private final @NonNull String name;
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.Strings;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.Serial;
import java.nio.charset.StandardCharsets;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
* Type-safe encapsulation of a cluster member name.
- *
- * @author Robert Varga
*/
-@Beta
public final class MemberName implements Comparable<MemberName>, WritableIdentifier {
private static final class Proxy implements Externalizable {
+ @Serial
private static final long serialVersionUID = 1L;
+
private byte[] serialized;
// checkstyle flags the public modifier as redundant however it is explicitly needed for Java serialization to
}
}
+ @Serial
private static final long serialVersionUID = 1L;
private final @NonNull String name;
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 java.io.Serial;
import java.io.Serializable;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
* Note that this class specifies the {@link Immutable} contract, which means that all subclasses must follow this API
* contract.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
* @param <C> Message type
*/
-@Beta
public abstract class Message<T extends WritableIdentifier, C extends Message<T, C>> implements Immutable,
Serializable {
+ @Serial
private static final long serialVersionUID = 1L;
private final @NonNull ABIVersion version;
return (C)this;
}
- switch (toVersion) {
- case BORON:
- case NEON_SR2:
- case SODIUM_SR1:
- case MAGNESIUM:
- return verifyNotNull(cloneAsVersion(toVersion));
- case TEST_PAST_VERSION:
- case TEST_FUTURE_VERSION:
- default:
+ return switch (toVersion) {
+ case BORON, NEON_SR2, SODIUM_SR1, MAGNESIUM -> verifyNotNull(cloneAsVersion(toVersion));
+ case TEST_PAST_VERSION, TEST_FUTURE_VERSION ->
throw new IllegalArgumentException("Unhandled ABI version " + toVersion);
- }
+ default -> throw new IllegalArgumentException("Unhandled ABI version " + toVersion);
+ };
}
/**
import static java.util.Objects.requireNonNull;
import akka.actor.ActorRef;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
* A request message concept. Upon receipt of this message, the recipient will respond with either
* a {@link RequestSuccess} or a {@link RequestFailure} message.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
* @param <C> Message type
*/
-@Beta
public abstract class Request<T extends WritableIdentifier, C extends Request<T, C>> extends Message<T, C> {
+ @Serial
private static final long serialVersionUID = 1L;
+
private final @NonNull ActorRef replyTo;
protected Request(final @NonNull T target, final long sequence, final @NonNull ActorRef replyTo) {
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
/**
* A failure cause behind a {@link RequestFailure} to process a {@link Request}.
- *
- * @author Robert Varga
*/
-@Beta
public abstract class RequestException extends Exception {
+ @Serial
private static final long serialVersionUID = 1L;
protected RequestException(final @NonNull String message) {
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
import com.google.common.base.MoreObjects.ToStringHelper;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
* A failure response to a {@link Request}. Contains a {@link RequestException} detailing the cause for this failure.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
* @param <C> Message class
*/
-@Beta
public abstract class RequestFailure<T extends WritableIdentifier, C extends RequestFailure<T, C>>
extends Response<T, C> {
+ @Serial
private static final long serialVersionUID = 1L;
private final @NonNull RequestException cause;
*/
package org.opendaylight.controller.cluster.access.concepts;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
/**
* A successful reply to a {@link Request}.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
*/
-@Beta
public abstract class RequestSuccess<T extends WritableIdentifier, C extends RequestSuccess<T, C>> extends
Response<T, C> {
+ @Serial
private static final long serialVersionUID = 1L;
protected RequestSuccess(final @NonNull C success, final @NonNull ABIVersion version) {
*/
package org.opendaylight.controller.cluster.access.concepts;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.cluster.access.ABIVersion;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
* {@link RequestFailure} and {@link RequestSuccess}, which provide appropriate specialization. It is visible purely for
* the purpose of allowing to check if an object is either of those specializations with a single instanceof check.
*
- * @author Robert Varga
- *
* @param <T> Target identifier type
* @param <C> Message type
*/
-@Beta
public abstract class Response<T extends WritableIdentifier, C extends Response<T, C>> extends Message<T, C> {
+ @Serial
private static final long serialVersionUID = 1L;
Response(final @NonNull T target, final long sequence) {
*/
package org.opendaylight.controller.cluster.access.concepts;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
/**
* General error raised when the recipient of a {@link Request} determines that the request contains
* a {@link ClientIdentifier} which corresponds to an outdated generation.
- *
- * @author Robert Varga
*/
-@Beta
public final class RetiredGenerationException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
public RetiredGenerationException(final long originatingGeneration, final long newGeneration) {
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
import com.google.common.base.Strings;
+import java.io.Serial;
/**
* General error raised when the recipient of a {@link Request} fails to process a request.
- *
- * @author Robert Varga
*/
-@Beta
public final class RuntimeRequestException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
public RuntimeRequestException(final String message, final Throwable cause) {
*/
package org.opendaylight.controller.cluster.access.concepts;
-import com.google.common.annotations.Beta;
-
/**
* A tagging interface that specifies a message whose serialized size can be large and thus should be sliced into
* smaller chunks when transporting over the wire.
*
* @author Thomas Pantelis
*/
-@Beta
public interface SliceableMessage {
+ // Marker interface
}
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
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 java.io.Serial;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
import org.opendaylight.yangtools.concepts.WritableObjects;
/**
* Globally-unique identifier of a transaction.
- *
- * @author Robert Varga
*/
-@Beta
public final class TransactionIdentifier implements WritableIdentifier {
private static final class Proxy implements Externalizable {
+ @Serial
private static final long serialVersionUID = 1L;
+
private LocalHistoryIdentifier historyId;
private long transactionId;
}
}
+ @Serial
private static final long serialVersionUID = 1L;
+
private final @NonNull LocalHistoryIdentifier historyId;
private final long transactionId;
private String shortString;
@Override
public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof TransactionIdentifier)) {
- return false;
- }
-
- final TransactionIdentifier other = (TransactionIdentifier) obj;
- return transactionId == other.transactionId && historyId.equals(other.historyId);
+ return this == obj || obj instanceof TransactionIdentifier other && transactionId == other.transactionId
+ && historyId.equals(other.historyId);
}
public String toShortString() {
*/
package org.opendaylight.controller.cluster.access.concepts;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
/**
* General error raised when the recipient of a {@link Request} determines that it does not know how to handle
* the request.
- *
- * @author Robert Varga
*/
-@Beta
public final class UnsupportedRequestException extends RequestException {
+ @Serial
private static final long serialVersionUID = 1L;
public UnsupportedRequestException(final Request<?, ?> request) {
import akka.actor.ActorRef;
import akka.actor.PoisonPill;
import akka.persistence.AbstractPersistentActor;
-import com.google.common.annotations.Beta;
import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Frontend actor which takes care of persisting generations and creates an appropriate ClientIdentifier.
- *
- * @author Robert Varga
*/
-@Beta
public abstract class AbstractClientActor extends AbstractPersistentActor {
private static final Logger LOG = LoggerFactory.getLogger(AbstractClientActor.class);
private AbstractClientActorBehavior<?> currentBehavior;
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
import com.google.common.base.Stopwatch;
import com.google.common.base.Verify;
import java.util.Collection;
/**
* A behavior, which handles messages sent to a {@link AbstractClientActor}.
- *
- * @author Robert Varga
*/
-@Beta
public abstract class ClientActorBehavior<T extends BackendInfo> extends
RecoveredClientActorBehavior<ClientActorContext> implements Identifiable<ClientIdentifier> {
/**
import akka.actor.ActorSystem;
import akka.actor.Cancellable;
import akka.actor.Scheduler;
-import com.google.common.annotations.Beta;
import com.google.common.base.Ticker;
import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNull;
* Time-keeping in a client actor is based on monotonic time. The precision of this time can be expected to be the
* same as {@link System#nanoTime()}, but it is not tied to that particular clock. Actor clock is exposed as
* a {@link Ticker}, which can be obtained via {@link #ticker()}. This class is thread-safe.
- *
- * @author Robert Varga
*/
-@Beta
public class ClientActorContext extends AbstractClientActorContext implements Identifiable<ClientIdentifier> {
private final ExecutionContext executionContext;
private final ClientIdentifier identifier;
final ClientIdentifier identifier, final ClientActorConfig config) {
super(self, persistenceId);
this.identifier = requireNonNull(identifier);
- this.scheduler = requireNonNull(system).scheduler();
- this.executionContext = system.dispatcher();
- this.dispatchers = new Dispatchers(system.dispatchers());
+ scheduler = requireNonNull(system).scheduler();
+ executionContext = system.dispatcher();
+ dispatchers = new Dispatchers(system.dispatchers());
this.config = requireNonNull(config);
messageSlicer = MessageSlicer.builder().messageSliceSize(config.getMaximumMessageSliceSize())
*/
package org.opendaylight.controller.cluster.access.client;
-import com.google.common.annotations.Beta;
import java.util.Optional;
import org.opendaylight.controller.cluster.access.concepts.RequestException;
-@Beta
public final class ConnectingClientConnection<T extends BackendInfo> extends AbstractClientConnection<T> {
/**
* A wild estimate on how deep a queue should be. Without having knowledge of the remote actor we can only
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 java.util.function.Consumer;
/**
* Single entry in a {@link AbstractClientConnection}. Tracks the request, the associated callback and time when
* the request was first enqueued.
- *
- * @author Robert Varga
*/
-@Beta
public class ConnectionEntry implements Immutable {
private final Consumer<Response<?, ?>> callback;
private final Request<?, ?> request;
ConnectionEntry(final Request<?, ?> request, final Consumer<Response<?, ?>> callback, final long now) {
this.request = requireNonNull(request);
this.callback = requireNonNull(callback);
- this.enqueuedTicks = now;
+ enqueuedTicks = now;
}
ConnectionEntry(final ConnectionEntry entry) {
*/
package org.opendaylight.controller.cluster.access.client;
-import com.google.common.annotations.Beta;
-import com.google.common.base.Verify;
+import static com.google.common.base.Verify.verify;
+import static com.google.common.base.Verify.verifyNotNull;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.VarHandle;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import java.util.concurrent.locks.StampedLock;
/**
* A lock implementation which allows users to perform optimistic reads and validate them in a fashion similar
* to {@link StampedLock}. In case a read is contented with a write, the read side will throw
* an {@link InversibleLockException}, which the caller can catch and use to wait for the write to resolve.
- *
- * @author Robert Varga
*/
-@Beta
public final class InversibleLock {
- private static final AtomicReferenceFieldUpdater<InversibleLock, CountDownLatch> LATCH_UPDATER =
- AtomicReferenceFieldUpdater.newUpdater(InversibleLock.class, CountDownLatch.class, "latch");
+ private static final VarHandle LATCH;
+
+ static {
+ try {
+ LATCH = MethodHandles.lookup().findVarHandle(InversibleLock.class, "latch", CountDownLatch.class);
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ throw new ExceptionInInitializerError(e);
+ }
+ }
private final StampedLock lock = new StampedLock();
+
private volatile CountDownLatch latch;
/**
// Write-locked. Read the corresponding latch and if present report an exception, which will propagate
// and force release of locks.
- final CountDownLatch local = latch;
+ final var local = latch;
if (local != null) {
throw new InversibleLockException(local);
}
}
public long writeLock() {
- final CountDownLatch local = new CountDownLatch(1);
- final boolean taken = LATCH_UPDATER.compareAndSet(this, null, local);
- Verify.verify(taken);
-
+ verify(LATCH.compareAndSet(this, null, new CountDownLatch(1)));
return lock.writeLock();
}
public void unlockWrite(final long stamp) {
- final CountDownLatch local = LATCH_UPDATER.getAndSet(this, null);
- Verify.verifyNotNull(local);
+ final CountDownLatch local = (CountDownLatch) LATCH.getAndSet(this, null);
+ verifyNotNull(local);
lock.unlockWrite(stamp);
local.countDown();
}
-
}
import static java.util.Objects.requireNonNull;
-import com.google.common.annotations.Beta;
+import java.io.Serial;
import java.util.concurrent.CountDownLatch;
/**
* Exception thrown from {@link InversibleLock#optimisticRead()} and can be used to wait for the racing write
* to complete using {@link #awaitResolution()}.
- *
- * @author Robert Varga
*/
-@Beta
public final class InversibleLockException extends RuntimeException {
+ @Serial
private static final long serialVersionUID = 1L;
private final transient CountDownLatch latch;