Class HazelcastCluster

java.lang.Object
com.norconex.crawler.core.cluster.impl.hazelcast.HazelcastCluster
All Implemented Interfaces:
Cluster, Closeable, AutoCloseable

public class HazelcastCluster extends Object implements Cluster
  • Constructor Details

  • Method Details

    • getCrawlerId

      public String getCrawlerId()
    • getLocalNode

      public ClusterNode getLocalNode()
      Specified by:
      getLocalNode in interface Cluster
    • getCacheManager

      public CacheManager getCacheManager()
      Specified by:
      getCacheManager in interface Cluster
    • getPipelineManager

      public PipelineManager getPipelineManager()
      Specified by:
      getPipelineManager in interface Cluster
    • getCrawlSession

      public CrawlerSession getCrawlSession()
      Description copied from interface: Cluster
      Returns the crawl session bound to this cluster node, or null if the session has not been bound yet.
      Specified by:
      getCrawlSession in interface Cluster
      Returns:
      the crawl session
    • bindSession

      public void bindSession(CrawlerSession session)
      Description copied from interface: Cluster
      Binds the given crawl session to this cluster node. Called once during session initialization.
      Specified by:
      bindSession in interface Cluster
      Parameters:
      session - the crawl session
    • init

      public void init(Path workDir, boolean clustered, Map<String,Class<?>> cacheTypes)
      Specified by:
      init in interface Cluster
    • createHazelcastInstance

      protected com.hazelcast.core.HazelcastInstance createHazelcastInstance(com.hazelcast.config.Config hzConfig)
    • startStopMonitoring

      public void startStopMonitoring()
      Description copied from interface: Cluster
      Starts monitoring for stop signals. Should only be called by commands that need to respond to stop requests (e.g., CrawlerCommand).
      Specified by:
      startStopMonitoring in interface Cluster
    • addCoordinatorChangeListener

      public void addCoordinatorChangeListener(CoordinatorChangeListener listener)
    • removeCoordinatorChangeListener

      public void removeCoordinatorChangeListener(CoordinatorChangeListener listener)
    • stop

      public void stop()
      Description copied from interface: Cluster
      Requests to stop the cluster. Does not wait.
      Specified by:
      stop in interface Cluster
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Cluster
    • getNodeCount

      public int getNodeCount()
      Description copied from interface: Cluster
      Returns the number of nodes in the cluster.
      Specified by:
      getNodeCount in interface Cluster
      Returns:
      node count
    • getNodeNames

      public List<String> getNodeNames()
      Description copied from interface: Cluster
      Returns the names of all nodes in the cluster.
      Specified by:
      getNodeNames in interface Cluster
      Returns:
      node names
    • getWorkingNodeNames

      public Set<String> getWorkingNodeNames()
      Returns the names of the nodes still working on the crawl: those that may still finish the documents they took for processing. A node that left the cluster is not one of them. Implementations that track more than membership also leave out a node that stopped sending news of itself, or that is done with the step the crawl is running. Documents taken by a node not listed may be given to another one.

      A member of the cluster is working unless its latest worker heartbeat for this crawl run is older than the node expiry timeout (the rule the pipeline coordinator uses to mark a node expired), or reports it done (in a terminal status) with the step its pipeline is running. A member with no heartbeat yet for this run is working: it has just joined.

      Specified by:
      getWorkingNodeNames in interface Cluster
      Returns:
      the working node names, empty if they cannot be told
    • isStandalone

      public boolean isStandalone()
    • isClustered

      public boolean isClustered()
      Description copied from interface: Cluster
      Whether this cluster can have more than one node. When it cannot, no other node may ever take over what this one is processing.
      Specified by:
      isClustered in interface Cluster
      Returns:
      true if clustered
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getWorkDir

      public Path getWorkDir()
    • getConfiguration

      public HazelcastClusterConnectorConfig getConfiguration()