com.netflix.eureka.cluster
Class PeerEurekaNode

java.lang.Object
  extended by com.netflix.eureka.cluster.PeerEurekaNode

public class PeerEurekaNode
extends java.lang.Object

The PeerEurekaNode represents a peer node to which information should be shared from this node.

This class handles replicating all update operations like Register,Renew,Cancel,Expiration and Status Changes to the eureka node it represents.


Field Summary
static java.lang.String HEADER_REPLICATION
           
 
Constructor Summary
PeerEurekaNode(java.lang.String serviceUrl)
           
 
Method Summary
 void cancel(java.lang.String appName, java.lang.String id)
          Send the cancellation information of an instance to the node represented by this class.
 void destroyResources()
          Destroy the resources created for communication with the Peer Eureka Server.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getServiceUrl()
          Get the service Url of the peer eureka node.
 int hashCode()
           
 void heartbeat(java.lang.String appName, java.lang.String id, com.netflix.appinfo.InstanceInfo info, com.netflix.appinfo.InstanceInfo.InstanceStatus overriddenStatus, boolean primeConnection)
          Send the heartbeat information of an instance to the node represented by this class.
 void register(com.netflix.appinfo.InstanceInfo info)
          Sends the registration information of InstanceInfo receiving by this node to the peer node represented by this class.
 void shutDown()
          Shuts down all resources used for peer replication.
 void statusUpdate(java.lang.String asgName, ASGResource.ASGStatus newStatus)
          Send the status information of of the ASG represented by the instance.
 void statusUpdate(java.lang.String appName, java.lang.String id, com.netflix.appinfo.InstanceInfo.InstanceStatus newStatus, com.netflix.appinfo.InstanceInfo info)
          Send the status update of the instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEADER_REPLICATION

public static final java.lang.String HEADER_REPLICATION
See Also:
Constant Field Values
Constructor Detail

PeerEurekaNode

public PeerEurekaNode(java.lang.String serviceUrl)
Method Detail

register

public void register(com.netflix.appinfo.InstanceInfo info)
              throws java.lang.Exception
Sends the registration information of InstanceInfo receiving by this node to the peer node represented by this class.

Parameters:
info - the instance information InstanceInfo of any instance that is send to this instance.
Throws:
java.lang.Exception

cancel

public void cancel(java.lang.String appName,
                   java.lang.String id)
            throws java.lang.Exception
Send the cancellation information of an instance to the node represented by this class.

Parameters:
appName - the application name of the instance.
id - the unique identifier of the instance.
Throws:
java.lang.Exception

heartbeat

public void heartbeat(java.lang.String appName,
                      java.lang.String id,
                      com.netflix.appinfo.InstanceInfo info,
                      com.netflix.appinfo.InstanceInfo.InstanceStatus overriddenStatus,
                      boolean primeConnection)
               throws java.lang.Throwable
Send the heartbeat information of an instance to the node represented by this class. If the instance does not exist the node, the instance registration information is sent again to the peer node.

Parameters:
appName - the application name of the instance.
id - the unique identifier of the instance.
info - the instance info InstanceInfo of the instance.
overriddenStatus - the overridden status information if any of the instance.
Throws:
java.lang.Throwable

statusUpdate

public void statusUpdate(java.lang.String asgName,
                         ASGResource.ASGStatus newStatus)
Send the status information of of the ASG represented by the instance.

ASG (Autoscaling group) names are available for instances in AWS and the ASG information is used for determining if the instance should be registered as InstanceInfo.InstanceStatus.DOWN or InstanceInfo.InstanceStatus.UP.

Parameters:
asgName - the asg name if any of this instance.
newStatus - the new status of the ASG.

statusUpdate

public void statusUpdate(java.lang.String appName,
                         java.lang.String id,
                         com.netflix.appinfo.InstanceInfo.InstanceStatus newStatus,
                         com.netflix.appinfo.InstanceInfo info)
Send the status update of the instance.

Parameters:
appName - the application name of the instance.
id - the unique identifier of the instance.
newStatus - the new status of the instance.
info - the instance information of the instance.

getServiceUrl

public java.lang.String getServiceUrl()
Get the service Url of the peer eureka node.

Returns:
the service Url of the peer eureka node.

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

destroyResources

public void destroyResources()
Destroy the resources created for communication with the Peer Eureka Server.


shutDown

public void shutDown()
Shuts down all resources used for peer replication.