java.lang.Object
com.norconex.crawler.core.cluster.impl.hazelcast.HazelcastUtil

public final class HazelcastUtil extends Object
  • Method Details

    • isPersistent

      public static boolean isPersistent(com.hazelcast.core.HazelcastInstance hazelcast, String name)
    • isSupportedCacheType

      public static boolean isSupportedCacheType(Object obj)
    • resolveStoreInstance

      public static com.hazelcast.core.HazelcastInstance resolveStoreInstance(com.hazelcast.core.HazelcastInstance hazelcastInstance, String hazelcastInstanceName, String storeName, String storeType)
      Resolves a HazelcastInstance for use by a store factory, with deterministic fallback behavior to handle EAGER store initialization timing while preventing accidental binding to stale clusters.

      Resolution order:

      1. Use the already-resolved instance if available
      2. Look up by instance name if provided
      3. Fall back to the single JVM-local instance if exactly one exists (handles EAGER loading before instance injection)
      4. Fail fast if ambiguous (multiple instances) or none available
      Parameters:
      hazelcastInstance - the already-resolved instance (may be null)
      hazelcastInstanceName - the instance name to look up (may be null)
      storeName - the name of the store/cache requesting the instance
      storeType - the type of store (e.g., "map", "queue") for error messages
      Returns:
      the resolved HazelcastInstance, never null
      Throws:
      IllegalStateException - if no instance can be resolved or if ambiguous
    • isPipelineTerminated

      public static boolean isPipelineTerminated(Pipeline pipeline, StepRecord stepRecord, boolean stopRequested)
      Whether a pipeline should be considered "terminated", either by completing all steps (success), or having a non-COMPLETED terminal status on any of the steps (aborting the pipeline), or, having a completed step when stopping was requested. A null step record suggests no steps have yet run so we consider it non-terminated.
      Parameters:
      pipeline - the pipeline
      stepRecord - the record of the last step ran/attempted.
      stopRequested - whether stop was requested
      Returns:
      true if terminated
    • currentPipelineStepRecordOrFirst

      public static StepRecord currentPipelineStepRecordOrFirst(HazelcastCluster cluster, Pipeline pipeline)
    • isClusterRunning

      public static boolean isClusterRunning(HazelcastCluster cluster)
    • waitForClusterWarmUp

      public static void waitForClusterWarmUp(HazelcastCluster cluster)