org.hibernate.search.backend.jgroups.impl

## Class AutoNodeSelector

- java.lang.Object
- - org.hibernate.search.backend.jgroups.impl.AutoNodeSelector

- All Implemented Interfaces:
    NodeSelectorStrategy

      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.

  Author:
    Sanne Grinovero (C) 2012 Red Hat Inc.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AutoNodeSelector(String indexName)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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(Address address)` The implementation might need to know it's own address, so this is provided at channel initial connection.
    `void` | `viewAccepted(View view)` Invoked by JGroups on view change.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AutoNodeSelector

          public AutoNodeSelector(String indexName)

      Parameters:
        `indexName` - the name of the index

  - ### Method Detail

    - #### isIndexOwnerLocal

          public boolean isIndexOwnerLocal()

      Description copied from interface: `NodeSelectorStrategy`
      Specifies if the current (local) node should apply changes to the index.
      Specified by:
        `isIndexOwnerLocal` in interface `NodeSelectorStrategy`
      Returns:
        true if the local node is the owner

    - #### setLocalAddress

          public void setLocalAddress(Address address)

      Description copied from interface: `NodeSelectorStrategy`
      The implementation might need to know it's own address, so this is provided at channel initial connection.
      Specified by:
        `setLocalAddress` in interface `NodeSelectorStrategy`
      Parameters:
        `address` - the local address

    - #### viewAccepted

          public void viewAccepted(View view)

      Description copied from interface: `NodeSelectorStrategy`
      Invoked by JGroups on view change. `MembershipListener.viewAccepted(View)`
      Specified by:
        `viewAccepted` in interface `NodeSelectorStrategy`
      Parameters:
        `view` - contains information on the current members of the cluster group

    - #### createMessage

          public Message createMessage(byte[] data)

      Description copied from interface: `NodeSelectorStrategy`
      Different message options can be applied using different constructors, hence we delegate Message construction to the strategy.
      Specified by:
        `createMessage` in interface `NodeSelectorStrategy`
      Parameters:
        `data` - the information to be sent to the master.
      Returns:
        the message to be sent.

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved