Exemplo n.º 1
0
  /** Removes the endpoint from Gossip but retains endpoint state */
  public void removeEndpoint(InetAddress endpoint) {
    // do subscribers first so anything in the subscriber that depends on gossiper state won't get
    // confused
    for (IEndpointStateChangeSubscriber subscriber : subscribers_) subscriber.onRemove(endpoint);

    liveEndpoints_.remove(endpoint);
    unreachableEndpoints_.remove(endpoint);
    // do not remove endpointState until aVeryLongTime
    FailureDetector.instance.remove(endpoint);
    justRemovedEndpoints_.put(endpoint, System.currentTimeMillis());
  }
Exemplo n.º 2
0
 void isAlive(InetAddress addr, EndpointState epState, boolean value) {
   epState.isAlive(value);
   if (value) {
     liveEndpoints_.add(addr);
     unreachableEndpoints_.remove(addr);
     for (IEndpointStateChangeSubscriber subscriber : subscribers_)
       subscriber.onAlive(addr, epState);
   } else {
     liveEndpoints_.remove(addr);
     unreachableEndpoints_.put(addr, System.currentTimeMillis());
     for (IEndpointStateChangeSubscriber subscriber : subscribers_)
       subscriber.onDead(addr, epState);
   }
   if (epState.isAGossiper()) return;
   epState.isAGossiper(true);
 }
Exemplo n.º 3
0
 void doNotifications(InetAddress addr, ApplicationState state, VersionedValue value) {
   for (IEndpointStateChangeSubscriber subscriber : subscribers_) {
     subscriber.onChange(addr, state, value);
   }
 }
Exemplo n.º 4
0
 /**
  * This method is called whenever there is a "big" change in ep state (either a previously unknown
  * node or a generation change for a known node). If the node is new, it will be initially marked
  * as dead. It will be marked alive as soon as another piece of gossip arrives. On the other hand
  * if the node is already known (generation change), we will immediately mark it alive.
  *
  * @param ep endpoint
  * @param epState EndpointState for the endpoint
  * @param isKnownNode is this node familiar to us already (present in endpointStateMap)
  */
 private void handleMajorStateChange(InetAddress ep, EndpointState epState, boolean isKnownNode) {
   endpointStateMap_.put(ep, epState);
   isAlive(ep, epState, isKnownNode);
   for (IEndpointStateChangeSubscriber subscriber : subscribers_) subscriber.onJoin(ep, epState);
 }