Record Class ObjectRef
- Record Components:
objectId- unique exported object identifier within the hosting runtimelogicalName- concrete logical object nameserviceName- logical service name used for lookup and HA alternativesruntimeId- hosting runtime identifierregistryContext- registry context used for isolationinterfaces- exposed Java interface namestransport- transport identifierendpoint- transport endpoint addressleaseUntil- lease expiration timestamp in milliseconds, or0when not leasedgeneration- export generation used to distinguish restarted instancesmetadata- public object metadata and query parameters
- All Implemented Interfaces:
Serializable
An ObjectRef is not just an endpoint. It identifies an object
instance, describes the logical service it belongs to, and carries enough
metadata for registry lookup and HA replacement selection. The record is
immutable and thread-safe.
References are routing evidence, not bearer authorization tokens. A caller still needs normal security context, authorization, fencing, and deadline checks before invocation. Metadata must be safe for status and audit output; credentials and sensitive values belong in security context, not in this record. JPMS module boundaries are unaffected by a reference: a reference to an exported object does not grant reflective access to non-exported packages. Compatibility is based on stable public fields and interface names, so future versions may add metadata keys but must preserve these record components.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionObjectRef(String objectId, String logicalName, String serviceName, String runtimeId, String registryContext, List<String> interfaces, String transport, String endpoint, long leaseUntil, long generation, Map<String, String> metadata) Creates a reference with immutable collection fields. -
Method Summary
Modifier and TypeMethodDescriptionendpoint()Returns the value of theendpointrecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of thegenerationrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theinterfacesrecord component.booleanisLeaseActive(long nowMillis) Returns whether the reference lease is active at the supplied timestamp.longReturns the value of theleaseUntilrecord component.Returns the value of thelogicalNamerecord component.metadata()Returns the value of themetadatarecord component.objectId()Returns the value of theobjectIdrecord component.Returns the value of theregistryContextrecord component.Returns the value of theruntimeIdrecord component.Returns the value of theserviceNamerecord component.toString()Returns a redacted diagnostic representation of this reference.Returns the value of thetransportrecord component.withLeaseUntil(long newLeaseUntil) Returns a copy of this reference with a new lease timestamp.withMetadata(Map<String, String> newMetadata) Returns a copy of this reference with new metadata.withTransport(String newTransport, String newEndpoint) Returns a copy of this reference with transport details.
-
Constructor Details
-
ObjectRef
-
-
Method Details
-
isLeaseActive
public boolean isLeaseActive(long nowMillis) Returns whether the reference lease is active at the supplied timestamp.- Parameters:
nowMillis- wall-clock timestamp in milliseconds- Returns:
- true when no lease is set or the lease is still active
-
withLeaseUntil
Returns a copy of this reference with a new lease timestamp.- Parameters:
newLeaseUntil- new lease timestamp in milliseconds- Returns:
- updated reference
-
withTransport
-
withMetadata
-
toString
Returns a redacted diagnostic representation of this reference.The returned text intentionally omits endpoint text, metadata keys, and metadata values. Object references may appear in status, audit, proxy, and error diagnostics; metadata is caller controlled and must not be rendered through
Map.toString()orkeySet().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. -
objectId
-
logicalName
Returns the value of thelogicalNamerecord component.- Returns:
- the value of the
logicalNamerecord component
-
serviceName
Returns the value of theserviceNamerecord component.- Returns:
- the value of the
serviceNamerecord component
-
runtimeId
-
registryContext
Returns the value of theregistryContextrecord component.- Returns:
- the value of the
registryContextrecord component
-
interfaces
Returns the value of theinterfacesrecord component.- Returns:
- the value of the
interfacesrecord component
-
transport
-
endpoint
-
leaseUntil
public long leaseUntil()Returns the value of theleaseUntilrecord component.- Returns:
- the value of the
leaseUntilrecord component
-
generation
public long generation()Returns the value of thegenerationrecord component.- Returns:
- the value of the
generationrecord component
-
metadata
-