public class ServiceInstance<T> extends Object
Constructor and Description |
---|
ServiceInstance(String name,
String id,
String address,
Integer port,
Integer sslPort,
T payload,
long registrationTimeUTC,
ServiceType serviceType,
UriSpec uriSpec) |
ServiceInstance(String name,
String id,
String address,
Integer port,
Integer sslPort,
T payload,
long registrationTimeUTC,
ServiceType serviceType,
UriSpec uriSpec,
boolean enabled)
IMPORTANT: Due to CURATOR-275 the
enabled field is NOT supported
by default. |
Modifier and Type | Method and Description |
---|---|
static <T> ServiceInstanceBuilder<T> |
builder()
Return a new builder.
|
String |
buildUriSpec() |
String |
buildUriSpec(Map<String,Object> variables) |
boolean |
equals(Object o) |
String |
getAddress() |
String |
getId() |
String |
getName() |
T |
getPayload() |
Integer |
getPort() |
long |
getRegistrationTimeUTC() |
ServiceType |
getServiceType() |
Integer |
getSslPort() |
UriSpec |
getUriSpec() |
int |
hashCode() |
boolean |
isEnabled()
IMPORTANT: Due to CURATOR-275 the
enabled field is NOT supported
by default. |
String |
toString() |
public ServiceInstance(String name, String id, String address, Integer port, Integer sslPort, T payload, long registrationTimeUTC, ServiceType serviceType, UriSpec uriSpec)
name
- name of the serviceid
- id of this instance (must be unique)address
- address of this instanceport
- the port for this instance or nullsslPort
- the SSL port for this instance or nullpayload
- the payload for this instance or nullregistrationTimeUTC
- the time (in UTC) of the registrationserviceType
- type of the serviceuriSpec
- the uri spec or nullpublic ServiceInstance(String name, String id, String address, Integer port, Integer sslPort, T payload, long registrationTimeUTC, ServiceType serviceType, UriSpec uriSpec, boolean enabled)
enabled
field is NOT supported
by default. If you wish to use the enabled field, you must set a InstanceSerializer
that serializes this field. The default serializer, JsonInstanceSerializer
does not
serialize the field by default. You must use the alternate constructor JsonInstanceSerializer(Class, boolean)
passing false for compatibleSerializationMode
.name
- name of the serviceid
- id of this instance (must be unique)address
- address of this instanceport
- the port for this instance or nullsslPort
- the SSL port for this instance or nullpayload
- the payload for this instance or nullregistrationTimeUTC
- the time (in UTC) of the registrationserviceType
- type of the serviceuriSpec
- the uri spec or nullenabled
- true if the instance should be considered enabledpublic static <T> ServiceInstanceBuilder<T> builder() throws Exception
address
is set to the ip of the first
NIC in the system. The id
is set to a random UUID.Exception
- errors getting the local IPpublic String getName()
public String getId()
public String getAddress()
public Integer getPort()
public Integer getSslPort()
public T getPayload()
public long getRegistrationTimeUTC()
public ServiceType getServiceType()
public UriSpec getUriSpec()
public boolean isEnabled()
enabled
field is NOT supported
by default. If you wish to use the enabled field, you must set a InstanceSerializer
that serializes this field. The default serializer, JsonInstanceSerializer
does not
serialize the field by default. You must use the alternate constructor JsonInstanceSerializer(Class, boolean)
passing false for compatibleSerializationMode
.public String buildUriSpec()
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.