Record Class FencingToken
java.lang.Object
java.lang.Record
org.j7m.middleware.api.reliability.FencingToken
- Record Components:
- fencing authority namescope- protected resource scopevalue- monotonic token value
- All Implemented Interfaces:
Serializable, Comparable<FencingToken>
public record FencingToken(String authority, String scope, long value)
extends Record
implements Comparable<FencingToken>, Serializable
Monotonic token issued by a named fencing authority for a protected scope.
The record is immutable, serializable, thread-safe, and comparable only within the same authority and scope. Tokens prevent stale owners only when the protected resource enforces them.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFencingToken(String authority, String scope, long value) Creates a validated fencing token. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theauthorityrecord component.intcompareTo(FencingToken other) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.scope()Returns the value of thescoperecord component.toString()longvalue()Returns the value of thevaluerecord component.
-
Constructor Details
-
FencingToken
Creates a validated fencing token.- Throws:
IllegalArgumentException- when authority or scope is invalid, or the value is negative
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<FencingToken>
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
authority
-
scope
-
value
-