Class HazelcastUtil
java.lang.Object
com.norconex.crawler.core.cluster.impl.hazelcast.HazelcastUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic StepRecordcurrentPipelineStepRecordOrFirst(HazelcastCluster cluster, Pipeline pipeline) static booleanisClusterRunning(HazelcastCluster cluster) static booleanisPersistent(com.hazelcast.core.HazelcastInstance hazelcast, String name) static booleanisPipelineTerminated(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.static booleanstatic com.hazelcast.core.HazelcastInstanceresolveStoreInstance(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.static voidwaitForClusterWarmUp(HazelcastCluster cluster)
-
Method Details
-
isPersistent
-
isSupportedCacheType
-
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:
- Use the already-resolved instance if available
- Look up by instance name if provided
- Fall back to the single JVM-local instance if exactly one exists (handles EAGER loading before instance injection)
- 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 instancestoreType- 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. Anullstep record suggests no steps have yet run so we consider it non-terminated.- Parameters:
pipeline- the pipelinestepRecord- 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
-
waitForClusterWarmUp
-