Record Class TaskLease
java.lang.Object
java.lang.Record
org.j7m.middleware.workload.api.TaskLease
- Record Components:
taskId- task idowner- lease ownerleaseUntil- expiration instantfencingToken- fencing token proving the ownership generation
public record TaskLease(TaskId taskId, LeaseOwner owner, Instant leaseUntil, FencingToken fencingToken)
extends Record
Current lease ownership for a workload task.
-
Constructor Summary
ConstructorsConstructorDescriptionTaskLease(TaskId taskId, LeaseOwner owner, Instant leaseUntil, FencingToken fencingToken) Creates validated lease fields. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of thefencingTokenrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns whether the lease is valid at the supplied instant.Returns the value of theleaseUntilrecord component.owner()Returns the value of theownerrecord component.taskId()Returns the value of thetaskIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TaskLease
Creates validated lease fields.
-
-
Method Details
-
isLiveAt
Returns whether the lease is valid at the supplied instant.- Parameters:
now- comparison instant- Returns:
truewhen not expired
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
taskId
-
owner
-
leaseUntil
Returns the value of theleaseUntilrecord component.- Returns:
- the value of the
leaseUntilrecord component
-
fencingToken
Returns the value of thefencingTokenrecord component.- Returns:
- the value of the
fencingTokenrecord component
-