Package org.kiwiproject.registry.model
Class ServiceInstance
java.lang.Object
org.kiwiproject.registry.model.ServiceInstance
Model containing information about a running service
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static enum
The status of a service -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
boolean
static ServiceInstance
fromServiceInfo
(ServiceInfo serviceInfo) Returns a newServiceInstanceBuilder
built from a givenServiceInfo
.Returns the admin port of this instance, preferring the secure port (if both secure and insecure exist).Returns the application port of this instance, preferring the secure port (if both secure and insecure exist).getIp()
Used to store extra data in a discovery service for this instanceUsed to store native registry data that includes data mapped intoServiceInstance
as well as any additional information that is not mapped.getPaths()
getPorts()
Returns the Instant this service has been up since, orInstant.EPOCH
if no value was provided when this instance was created.long
Returns the time since the epoch this service has been up since, or zero (the epoch), if no value was provided when this instance was created.int
hashCode()
toString()
withHostName
(String hostName) withInstanceId
(String instanceId) withMetadata
(Map<String, String> metadata) Used to store extra data in a discovery service for this instancewithNativeRegistryData
(Map<String, Object> nativeRegistryData) Used to store native registry data that includes data mapped intoServiceInstance
as well as any additional information that is not mapped.withStatus
(ServiceInstance.Status status)
-
Method Details
-
fromServiceInfo
Returns a newServiceInstanceBuilder
built from a givenServiceInfo
.Note that a copy of
ServiceInfo.getMetadata()
is made usingMap.copyOf(Map)
, so the metadata is unmodifiable.- Parameters:
serviceInfo
- The information about the service used to initialize theServiceInstanceBuilder
- Returns:
- a
ServiceInstanceBuilder
with values copied from the givenServiceInfo
-
getUpSince
Returns the Instant this service has been up since, orInstant.EPOCH
if no value was provided when this instance was created.- Returns:
- a non-null Instant representing the instant this service was started, or the epoch if no value provided
-
getUpSinceMillis
public long getUpSinceMillis()Returns the time since the epoch this service has been up since, or zero (the epoch), if no value was provided when this instance was created.- Returns:
- the number of milliseconds since the epoch that this service was started, or zero if no value provided
-
getApplicationPort
Returns the application port of this instance, preferring the secure port (if both secure and insecure exist).- Returns:
- the application port
- See Also:
-
getAdminPort
Returns the admin port of this instance, preferring the secure port (if both secure and insecure exist).- Returns:
- the admin port
- See Also:
-
builder
-
toBuilder
-
getInstanceId
-
getStatus
-
getServiceName
-
getHostName
-
getIp
-
getPorts
-
getPaths
-
getCommitRef
-
getDescription
-
getVersion
-
getMetadata
Used to store extra data in a discovery service for this instance -
getNativeRegistryData
Used to store native registry data that includes data mapped intoServiceInstance
as well as any additional information that is not mapped. This will only be populated if the registry configuration specifies to include native data. -
equals
-
hashCode
public int hashCode() -
toString
-
withInstanceId
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withStatus
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withHostName
- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withMetadata
Used to store extra data in a discovery service for this instance- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
withNativeRegistryData
Used to store native registry data that includes data mapped intoServiceInstance
as well as any additional information that is not mapped. This will only be populated if the registry configuration specifies to include native data.- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-