com.netflix.appinfo
Class InstanceInfo

java.lang.Object
  extended by com.netflix.appinfo.InstanceInfo

@Serializer(value="com.netflix.discovery.converters.EntityBodyConverter")
public class InstanceInfo
extends java.lang.Object

The class that holds information required for registration with Eureka Server and to be discovered by other components.

@Auto annotated fields are serialized as is; Other fields are serialized as specified by the @Serializer.


Nested Class Summary
static class InstanceInfo.ActionType
           
static class InstanceInfo.Builder
           
static class InstanceInfo.InstanceStatus
           
static class InstanceInfo.PortType
           
 
Field Summary
static int DEFAULT_COUNTRY_ID
           
static int DEFAULT_PORT
           
static int DEFAULT_SECURE_PORT
           
 
Constructor Summary
InstanceInfo(InstanceInfo ii)
          shallow copy constructor
 
Method Summary
 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 DiscoveryClient instance.
 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.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()
          Returns the fully qualified hostname of this running instance
 java.lang.String getId()
          Returns the unique id of the instance.
 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.
 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.
 int hashCode()
           
 java.lang.Boolean isCoordinatingDiscoveryServer()
          Finds if this instance is the coordinating discovery server.
 boolean isDirty()
          Returns whether any state changed so that DiscoveryClient can check whether to retransmit info or not on the next heartbeat.
 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(boolean b)
          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. 
 void 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_SECURE_PORT

public static final int DEFAULT_SECURE_PORT
See Also:
Constant Field Values

DEFAULT_COUNTRY_ID

public static final int DEFAULT_COUNTRY_ID
See Also:
Constant Field Values
Constructor Detail

InstanceInfo

public InstanceInfo(InstanceInfo ii)
shallow copy constructor

Parameters:
ii - The object to copy
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getAppName

public java.lang.String getAppName()
Return the name of the application registering with discovery.

Returns:
the string denoting the application name.

getHostName

public java.lang.String getHostName()
Returns the fully qualified hostname of this running instance

Returns:
the hostname.

setSID

@Deprecated
public void setSID(java.lang.String sid)
Deprecated. 


getSID

@Deprecated
public java.lang.String getSID()
Deprecated. 


getId

public java.lang.String getId()
Returns the unique id of the instance.

Returns:
the unique id.

getIPAddr

public java.lang.String getIPAddr()
Returns the ip address of the instance.

Returns:
- the ip address, in AWS scenario it is a private IP.

getPort

public int getPort()
Returns the port number that is used for servicing requests.

Returns:
- the non-secure port number.

getStatus

public InstanceInfo.InstanceStatus getStatus()
Returns the status of the instance.

Returns:
the status indicating whether the instance can handle requests.

getOverriddenStatus

public InstanceInfo.InstanceStatus getOverriddenStatus()
Returns the overridden status if any of the instance.

Returns:
the status indicating whether an external process has changed the status.

getDataCenterInfo

public DataCenterInfo getDataCenterInfo()
Returns data center information identifying if it is AWS or not.

Returns:
the data center information.

getLeaseInfo

public LeaseInfo getLeaseInfo()
Returns the lease information regarding when it expires.

Returns:
the lease information of this instance.

setLeaseInfo

public void setLeaseInfo(LeaseInfo info)
Sets the lease information regarding when it expires.

Parameters:
info - the lease information of this instance.

getMetadata

public java.util.Map<java.lang.String,java.lang.String> getMetadata()
Returns all application specific metadata set on the instance.

Returns:
application specific metadata.

getCountryId

@Deprecated
public int getCountryId()
Deprecated. 


getSecurePort

public int getSecurePort()
Returns the secure port that is used for servicing requests.

Returns:
the secure port.

isPortEnabled

public boolean isPortEnabled(InstanceInfo.PortType type)
Checks whether a port is enabled for traffic or not.

Parameters:
type - indicates whether it is secure or non-secure port.
Returns:
true if the port is enabled, false otherwise.

getLastUpdatedTimestamp

public long getLastUpdatedTimestamp()
Returns the time elapsed since epoch since the instance status has been last updated.

Returns:
the time elapsed since epoch since the instance has been last updated.

setLastUpdatedTimestamp

public void setLastUpdatedTimestamp()
Set the update time for this instance when the status was update.


getHomePageUrl

public java.lang.String getHomePageUrl()
Gets the home page URL set for this instance.

Returns:
home page URL

getStatusPageUrl

public java.lang.String getStatusPageUrl()
Gets the status page URL set for this instance.

Returns:
status page URL

getHealthCheckUrls

public java.util.Set<java.lang.String> getHealthCheckUrls()
Gets the absolute URLs for the health check page for both secure and non-secure protocols. If the port is not enabled then the URL is excluded.

Returns:
A Set containing the string representation of health check urls for secure and non secure protocols

getVIPAddress

public java.lang.String getVIPAddress()
Gets the Virtual Internet Protocol address for this instance. Defaults to hostname if not specified.

Returns:
- The Virtual Internet Protocol address

getSecureVipAddress

public java.lang.String getSecureVipAddress()
Get the Secure Virtual Internet Protocol address for this instance. Defaults to hostname if not specified.

Returns:
- The Secure Virtual Internet Protocol address.

getLastDirtyTimestamp

public java.lang.Long getLastDirtyTimestamp()
Gets the last time stamp when this instance was touched.

Returns:
last timestamp when this instance was touched.

setLastDirtyTimestamp

public void setLastDirtyTimestamp(java.lang.Long lastDirtyTimestamp)
Set the time indicating that the instance was touched.

Parameters:
lastDirtyTimestamp - time when the instance was touched.

setStatus

public void setStatus(InstanceInfo.InstanceStatus status)
Set the status for this instance.

Parameters:
status - status for this instance.

setStatusWithoutDirty

public void setStatusWithoutDirty(InstanceInfo.InstanceStatus status)
Set the status for this instance without updating the dirty timestamp.

Parameters:
status - status for this instance.

setOverriddenStatus

public void setOverriddenStatus(InstanceInfo.InstanceStatus status)
Sets the overridden status for this instance.Normally set by an external process to disable instance from taking traffic.

Parameters:
status - overridden status for this instance.

isDirty

public boolean isDirty()
Returns whether any state changed so that DiscoveryClient can check whether to retransmit info or not on the next heartbeat.

Returns:
true if the InstanceInfo is dirty, false otherwise.

setIsDirty

public void setIsDirty(boolean b)
Sets the dirty flag so that the instance information can be carried to the discovery server on the next heartbeat.

Parameters:
b - - true if dirty, false otherwise.

setIsCoordinatingDiscoveryServer

public void setIsCoordinatingDiscoveryServer()
Sets a flag if this instance is the same as the discovery server that is return the instances. This flag is used by the discovery clients to identity the discovery server which is coordinating/returning the information.


isCoordinatingDiscoveryServer

public java.lang.Boolean isCoordinatingDiscoveryServer()
Finds if this instance is the coordinating discovery server.

Returns:
- true, if this instance is the coordinating discovery server, false otherwise.

getActionType

public InstanceInfo.ActionType getActionType()
Returns the type of action done on the instance in the server.Primarily used for updating deltas in the DiscoveryClient instance.

Returns:
action type done on the instance.

setActionType

public void setActionType(InstanceInfo.ActionType actionType)
Set the action type performed on this instance in the server.

Parameters:
actionType - action type done on the instance.

getASGName

public java.lang.String getASGName()
Get AWS autoscaling group name if any.

Returns:
autoscaling group name of this instance.

getVersion

@Deprecated
public java.lang.String getVersion()
Deprecated. 

Returns the specification version of this application

Returns:
the string indicating the version of the application.