Package org.kiwiproject.registry.model
Class ServiceInstance
- java.lang.Object
-
- org.kiwiproject.registry.model.ServiceInstance
-
public class ServiceInstance extends Object
Model containing information about a running service
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ServiceInstance.Status
The status of a service
-
Constructor Summary
Constructors Constructor Description ServiceInstance()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ServiceInstance
fromServiceInfo(ServiceInfo serviceInfo)
Returns a newServiceInstanceBuilder
built from a givenServiceInfo
.Port
getAdminPort()
Returns the admin port of this instance, preferring the secure port (if both secure and insecure exist).Port
getApplicationPort()
Returns the application port of this instance, preferring the secure port (if both secure and insecure exist).Instant
getUpSince()
Returns the Instant this service has been up since, orInstant.EPOCH
if no value was provided when this instance was created.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.
-
-
-
Method Detail
-
fromServiceInfo
public static ServiceInstance fromServiceInfo(ServiceInfo serviceInfo)
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
public Instant 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
public Port getApplicationPort()
Returns the application port of this instance, preferring the secure port (if both secure and insecure exist).- Returns:
- the application port
- See Also:
Ports.findFirstPortPreferSecure(List, PortType)
-
getAdminPort
public Port getAdminPort()
Returns the admin port of this instance, preferring the secure port (if both secure and insecure exist).- Returns:
- the admin port
- See Also:
Ports.findFirstPortPreferSecure(List, PortType)
-
-