Class HazelcastUtil
java.lang.Object
com.norconex.crawler.core.cluster.impl.hazelcast.HazelcastUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longShortest node expiry timeout accepted, whatever is configured. -
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 longHow long a node may go without a heartbeat before it is considered gone: the configured node expiry timeout, never under 5000L milliseconds, or the configuration's default when none is set.static 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)
-
Field Details
-
MIN_NODE_EXPIRY_TIMEOUT_MS
public static final long MIN_NODE_EXPIRY_TIMEOUT_MSShortest node expiry timeout accepted, whatever is configured.- See Also:
-
-
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) -
nodeExpiryTimeoutMs
How long a node may go without a heartbeat before it is considered gone: the configured node expiry timeout, never under 5000L milliseconds, or the configuration's default when none is set.- Parameters:
config- the cluster connector configuration- Returns:
- the node expiry timeout, in milliseconds
-
isClusterRunning
-
waitForClusterWarmUp
-