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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumThe status of a service -
Method Summary
Modifier and TypeMethodDescriptionbuilder()booleanstatic ServiceInstancefromServiceInfo(ServiceInfo serviceInfo) Returns a newServiceInstanceBuilderbuilt 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 intoServiceInstanceas well as any additional information that is not mapped.getPaths()getPorts()Returns the Instant this service has been up since, orInstant.EPOCHif no value was provided when this instance was created.longReturns 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.inthashCode()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 intoServiceInstanceas well as any additional information that is not mapped.withStatus(ServiceInstance.Status status)
-
Method Details
-
fromServiceInfo
Returns a newServiceInstanceBuilderbuilt 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
ServiceInstanceBuilderwith values copied from the givenServiceInfo
-
getUpSince
Returns the Instant this service has been up since, orInstant.EPOCHif 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 intoServiceInstanceas 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
thisif an identical value is passed).
-
withStatus
- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
withHostName
- Returns:
- a clone of this object, except with this updated property (returns
thisif 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
thisif an identical value is passed).
-
withNativeRegistryData
Used to store native registry data that includes data mapped intoServiceInstanceas 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
thisif an identical value is passed).
-