org.elasticsearch.discovery.jgroups
Class JgroupsDiscovery

java.lang.Object
  extended by org.elasticsearch.util.component.AbstractComponent
      extended by org.elasticsearch.util.component.AbstractLifecycleComponent<Discovery>
          extended by org.elasticsearch.discovery.jgroups.JgroupsDiscovery
All Implemented Interfaces:
Discovery, CloseableComponent, LifecycleComponent<Discovery>, org.jgroups.MembershipListener, org.jgroups.MessageListener, org.jgroups.Receiver

public class JgroupsDiscovery
extends AbstractLifecycleComponent<Discovery>
implements Discovery, org.jgroups.Receiver


Field Summary
 
Fields inherited from class org.elasticsearch.util.component.AbstractLifecycleComponent
lifecycle
 
Fields inherited from class org.elasticsearch.util.component.AbstractComponent
componentSettings, logger, settings
 
Constructor Summary
JgroupsDiscovery(Settings settings, Environment environment, ClusterName clusterName, TransportService transportService, ClusterService clusterService)
           
 
Method Summary
 void addListener(InitialStateDiscoveryListener listener)
           
 void block()
           
protected  void doClose()
           
protected  void doStart()
           
protected  void doStop()
           
 boolean firstMaster()
          Is the discovery of this node caused this node to be the first master in the cluster.
 byte[] getState()
           
 java.lang.String nodeDescription()
           
 void publish(ClusterState clusterState)
          Publish all the changes to the cluster from the master (can be called just by the master).
 void receive(org.jgroups.Message msg)
           
 void removeListener(InitialStateDiscoveryListener listener)
           
 void setState(byte[] state)
           
 void suspect(org.jgroups.Address suspectedMember)
           
 void viewAccepted(org.jgroups.View newView)
           
 
Methods inherited from class org.elasticsearch.util.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
 
Methods inherited from class org.elasticsearch.util.component.AbstractComponent
nodeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.elasticsearch.util.component.LifecycleComponent
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop
 
Methods inherited from interface org.elasticsearch.util.component.CloseableComponent
close
 

Constructor Detail

JgroupsDiscovery

@Inject
public JgroupsDiscovery(Settings settings,
                               Environment environment,
                               ClusterName clusterName,
                               TransportService transportService,
                               ClusterService clusterService)
Method Detail

addListener

public void addListener(InitialStateDiscoveryListener listener)
Specified by:
addListener in interface Discovery

removeListener

public void removeListener(InitialStateDiscoveryListener listener)
Specified by:
removeListener in interface Discovery

doStart

protected void doStart()
                throws ElasticSearchException
Specified by:
doStart in class AbstractLifecycleComponent<Discovery>
Throws:
ElasticSearchException

doStop

protected void doStop()
               throws ElasticSearchException
Specified by:
doStop in class AbstractLifecycleComponent<Discovery>
Throws:
ElasticSearchException

doClose

protected void doClose()
                throws ElasticSearchException
Specified by:
doClose in class AbstractLifecycleComponent<Discovery>
Throws:
ElasticSearchException

nodeDescription

public java.lang.String nodeDescription()
Specified by:
nodeDescription in interface Discovery

firstMaster

public boolean firstMaster()
Description copied from interface: Discovery
Is the discovery of this node caused this node to be the first master in the cluster.

Specified by:
firstMaster in interface Discovery

publish

public void publish(ClusterState clusterState)
Description copied from interface: Discovery
Publish all the changes to the cluster from the master (can be called just by the master). The publish process should not publish this state to the master as well! (the master is sending it...).

Specified by:
publish in interface Discovery

receive

public void receive(org.jgroups.Message msg)
Specified by:
receive in interface org.jgroups.MessageListener

getState

public byte[] getState()
Specified by:
getState in interface org.jgroups.MessageListener

setState

public void setState(byte[] state)
Specified by:
setState in interface org.jgroups.MessageListener

viewAccepted

public void viewAccepted(org.jgroups.View newView)
Specified by:
viewAccepted in interface org.jgroups.MembershipListener

suspect

public void suspect(org.jgroups.Address suspectedMember)
Specified by:
suspect in interface org.jgroups.MembershipListener

block

public void block()
Specified by:
block in interface org.jgroups.MembershipListener