public class AutoNodeSelector extends Object implements NodeSelectorStrategy
This NodeSelectorStrategy picks a single master across all nodes participating
in the JGroups cluster deterministically: this way all nodes in the group will
have an agreement on which node is going to be the master.
Advantage: if the master node fails, a new node is elected.
Limitation: make sure all nodes in the group are having the same application running and use the same configuration, or the master might ignore incoming messages.
| Constructor and Description |
|---|
AutoNodeSelector(String indexName) |
| Modifier and Type | Method and Description |
|---|---|
org.jgroups.Message |
createMessage(byte[] data)
Different message options can be applied using different constructors,
hence we delegate Message construction to the strategy.
|
boolean |
isIndexOwnerLocal()
Specifies if the current (local) node should apply
changes to the index.
|
void |
setLocalAddress(org.jgroups.Address address)
The implementation might need to know it's own address, so this
is provided at channel initial connection.
|
void |
viewAccepted(org.jgroups.View view)
Invoked by JGroups on view change.
|
public AutoNodeSelector(String indexName)
indexName - the name of the indexpublic boolean isIndexOwnerLocal()
NodeSelectorStrategyisIndexOwnerLocal in interface NodeSelectorStrategypublic void setLocalAddress(org.jgroups.Address address)
NodeSelectorStrategysetLocalAddress in interface NodeSelectorStrategyaddress - the local addresspublic void viewAccepted(org.jgroups.View view)
NodeSelectorStrategyMembershipListener.viewAccepted(View)viewAccepted in interface NodeSelectorStrategyview - contains information on the current members of the cluster grouppublic org.jgroups.Message createMessage(byte[] data)
NodeSelectorStrategycreateMessage in interface NodeSelectorStrategydata - the information to be sent to the master.Copyright © 2006–2017 Hibernate. All rights reserved.