@Serializer(value="com.netflix.discovery.converters.EntityBodyConverter") public class InstanceInfo extends java.lang.Object
@Auto
annotated fields are serialized as is; Other fields are
serialized as specified by the @Serializer
.
Modifier and Type | Class and Description |
---|---|
static class |
InstanceInfo.ActionType |
static class |
InstanceInfo.Builder |
static class |
InstanceInfo.InstanceStatus |
static class |
InstanceInfo.PortType |
static class |
InstanceInfo.PortWrapper
InstanceInfo JSON and XML format for port information does not follow the usual conventions, which
makes its mapping complicated. |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_COUNTRY_ID |
static int |
DEFAULT_PORT |
static int |
DEFAULT_SECURE_PORT |
Constructor and Description |
---|
InstanceInfo(InstanceInfo ii)
shallow copy constructor.
|
InstanceInfo(java.lang.String instanceId,
java.lang.String appName,
java.lang.String appGroupName,
java.lang.String ipAddr,
java.lang.String sid,
InstanceInfo.PortWrapper port,
InstanceInfo.PortWrapper securePort,
java.lang.String homePageUrl,
java.lang.String statusPageUrl,
java.lang.String healthCheckUrl,
java.lang.String secureHealthCheckUrl,
java.lang.String vipAddress,
java.lang.String secureVipAddress,
int countryId,
DataCenterInfo dataCenterInfo,
java.lang.String hostName,
InstanceInfo.InstanceStatus status,
InstanceInfo.InstanceStatus overriddenstatus,
LeaseInfo leaseInfo,
java.lang.Boolean isCoordinatingDiscoveryServer,
java.util.HashMap<java.lang.String,java.lang.String> metadata,
java.lang.Long lastUpdatedTimestamp,
java.lang.Long lastDirtyTimestamp,
InstanceInfo.ActionType actionType,
java.lang.String asgName) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
InstanceInfo.ActionType |
getActionType()
Returns the type of action done on the instance in the server.Primarily
used for updating deltas in the
EurekaClient
instance. |
java.lang.String |
getAppGroupName() |
java.lang.String |
getAppName()
Return the name of the application registering with discovery.
|
java.lang.String |
getASGName()
Get AWS autoscaling group name if any.
|
int |
getCountryId()
Deprecated.
|
DataCenterInfo |
getDataCenterInfo()
Returns data center information identifying if it is AWS or not.
|
java.lang.String |
getHealthCheckUrl() |
java.util.Set<java.lang.String> |
getHealthCheckUrls()
Gets the absolute URLs for the health check page for both secure and
non-secure protocols.
|
java.lang.String |
getHomePageUrl()
Gets the home page
URL set for this instance. |
java.lang.String |
getHostName()
Return the default network address to connect to this instance.
|
java.lang.String |
getId()
Returns the unique id of the instance.
|
java.lang.String |
getInstanceId() |
java.lang.String |
getIPAddr()
Returns the ip address of the instance.
|
java.lang.Long |
getLastDirtyTimestamp()
Gets the last time stamp when this instance was touched.
|
long |
getLastUpdatedTimestamp()
Returns the time elapsed since epoch since the instance status has been
last updated.
|
LeaseInfo |
getLeaseInfo()
Returns the lease information regarding when it expires.
|
java.util.Map<java.lang.String,java.lang.String> |
getMetadata()
Returns all application specific metadata set on the instance.
|
InstanceInfo.InstanceStatus |
getOverriddenStatus()
Returns the overridden status if any of the instance.
|
int |
getPort()
Returns the port number that is used for servicing requests.
|
java.lang.String |
getSecureHealthCheckUrl() |
int |
getSecurePort()
Returns the secure port that is used for servicing requests.
|
java.lang.String |
getSecureVipAddress()
Get the Secure Virtual Internet Protocol address for this instance.
|
java.lang.String |
getSID()
Deprecated.
|
InstanceInfo.InstanceStatus |
getStatus()
Returns the status of the instance.
|
java.lang.String |
getStatusPageUrl()
Gets the status page
URL set for this instance. |
java.lang.String |
getVersion()
Deprecated.
|
java.lang.String |
getVIPAddress()
Gets the Virtual Internet Protocol address for this instance.
|
static java.lang.String |
getZone(java.lang.String[] availZones,
InstanceInfo myInfo)
Get the zone that a particular instance is in.
|
int |
hashCode() |
java.lang.Boolean |
isCoordinatingDiscoveryServer()
Finds if this instance is the coordinating discovery server.
|
boolean |
isDirty()
Returns whether any state changed so that
EurekaClient can
check whether to retransmit info or not on the next heartbeat. |
java.lang.Long |
isDirtyWithTime() |
boolean |
isPortEnabled(InstanceInfo.PortType type)
Checks whether a port is enabled for traffic or not.
|
void |
setActionType(InstanceInfo.ActionType actionType)
Set the action type performed on this instance in the server.
|
void |
setIsCoordinatingDiscoveryServer()
Sets a flag if this instance is the same as the discovery server that is
return the instances.
|
void |
setIsDirty()
Sets the dirty flag so that the instance information can be carried to
the discovery server on the next heartbeat.
|
void |
setIsDirty(boolean isDirty)
Deprecated.
use
setIsDirty() and unsetIsDirty(long) to set and unset
Sets the dirty flag so that the instance information can be carried to the discovery server on the next heartbeat. |
void |
setLastDirtyTimestamp(java.lang.Long lastDirtyTimestamp)
Set the time indicating that the instance was touched.
|
void |
setLastUpdatedTimestamp()
Set the update time for this instance when the status was update.
|
void |
setLeaseInfo(LeaseInfo info)
Sets the lease information regarding when it expires.
|
void |
setOverriddenStatus(InstanceInfo.InstanceStatus status)
Sets the overridden status for this instance.Normally set by an external
process to disable instance from taking traffic.
|
void |
setSID(java.lang.String sid)
Deprecated.
|
InstanceInfo.InstanceStatus |
setStatus(InstanceInfo.InstanceStatus status)
Set the status for this instance.
|
void |
setStatusWithoutDirty(InstanceInfo.InstanceStatus status)
Set the status for this instance without updating the dirty timestamp.
|
void |
unsetIsDirty(long unsetDirtyTimestamp)
Unset the dirty flag iff the unsetDirtyTimestamp matches the lastDirtyTimestamp.
|
public static final int DEFAULT_PORT
public static final int DEFAULT_SECURE_PORT
public static final int DEFAULT_COUNTRY_ID
public InstanceInfo(java.lang.String instanceId, java.lang.String appName, java.lang.String appGroupName, java.lang.String ipAddr, java.lang.String sid, InstanceInfo.PortWrapper port, InstanceInfo.PortWrapper securePort, java.lang.String homePageUrl, java.lang.String statusPageUrl, java.lang.String healthCheckUrl, java.lang.String secureHealthCheckUrl, java.lang.String vipAddress, java.lang.String secureVipAddress, int countryId, DataCenterInfo dataCenterInfo, java.lang.String hostName, InstanceInfo.InstanceStatus status, InstanceInfo.InstanceStatus overriddenstatus, LeaseInfo leaseInfo, java.lang.Boolean isCoordinatingDiscoveryServer, java.util.HashMap<java.lang.String,java.lang.String> metadata, java.lang.Long lastUpdatedTimestamp, java.lang.Long lastDirtyTimestamp, InstanceInfo.ActionType actionType, java.lang.String asgName)
public InstanceInfo(InstanceInfo ii)
ii
- The object to copypublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String getInstanceId()
getId()
public java.lang.String getAppName()
public java.lang.String getAppGroupName()
public java.lang.String getHostName()
EurekaInstanceConfig
to change the default value used
to populate this field using the EurekaInstanceConfig.getDefaultAddressResolutionOrder()
property.
If a use case need more specific hostnames or ips, please use data from getDataCenterInfo()
.
For legacy reasons, it is difficult to introduce a new address-type field that is agnostic to hostname/ip.@Deprecated public void setSID(java.lang.String sid)
@Deprecated public java.lang.String getSID()
public java.lang.String getId()
public java.lang.String getIPAddr()
public int getPort()
public InstanceInfo.InstanceStatus getStatus()
public InstanceInfo.InstanceStatus getOverriddenStatus()
public DataCenterInfo getDataCenterInfo()
public LeaseInfo getLeaseInfo()
public void setLeaseInfo(LeaseInfo info)
info
- the lease information of this instance.public java.util.Map<java.lang.String,java.lang.String> getMetadata()
@Deprecated public int getCountryId()
public int getSecurePort()
public boolean isPortEnabled(InstanceInfo.PortType type)
type
- indicates whether it is secure or non-secure port.public long getLastUpdatedTimestamp()
public void setLastUpdatedTimestamp()
public java.lang.String getHomePageUrl()
URL
set for this instance.URL
public java.lang.String getStatusPageUrl()
URL
set for this instance.URL
public java.util.Set<java.lang.String> getHealthCheckUrls()
public java.lang.String getHealthCheckUrl()
public java.lang.String getSecureHealthCheckUrl()
public java.lang.String getVIPAddress()
public java.lang.String getSecureVipAddress()
public java.lang.Long getLastDirtyTimestamp()
public void setLastDirtyTimestamp(java.lang.Long lastDirtyTimestamp)
lastDirtyTimestamp
- time when the instance was touched.public InstanceInfo.InstanceStatus setStatus(InstanceInfo.InstanceStatus status)
status
- status for this instance.public void setStatusWithoutDirty(InstanceInfo.InstanceStatus status)
status
- status for this instance.public void setOverriddenStatus(InstanceInfo.InstanceStatus status)
status
- overridden status for this instance.public boolean isDirty()
EurekaClient
can
check whether to retransmit info or not on the next heartbeat.InstanceInfo
is dirty, false otherwise.public java.lang.Long isDirtyWithTime()
@Deprecated public void setIsDirty(boolean isDirty)
setIsDirty()
and unsetIsDirty(long)
to set and unset
Sets the dirty flag so that the instance information can be carried to the discovery server on the next heartbeat.
isDirty
- true if dirty, false otherwise.public void setIsDirty()
public void unsetIsDirty(long unsetDirtyTimestamp)
unsetDirtyTimestamp
- the expected lastDirtyTimestamp to unset.public void setIsCoordinatingDiscoveryServer()
public java.lang.Boolean isCoordinatingDiscoveryServer()
public InstanceInfo.ActionType getActionType()
EurekaClient
instance.public void setActionType(InstanceInfo.ActionType actionType)
actionType
- action type done on the instance.public java.lang.String getASGName()
@Deprecated public java.lang.String getVersion()
public static java.lang.String getZone(java.lang.String[] availZones, InstanceInfo myInfo)
availZones
- the list of available zones for non-AWS deploymentsmyInfo
- - The InstanceInfo object of the instance.