Class DeferredMutations
java.lang.Object
org.openspaces.core.multicluster.internal.routing.DeferredMutations
- All Implemented Interfaces:
AutoCloseable
Work the proxy owes a cluster: mutations that could not be applied yet and will be retried until they
land.
Two situations produce them, and they want very different patience:
- a cluster was briefly unreachable - a few attempts over a few seconds, then give up and report it. Waiting longer just hides the problem;
- a cluster is quiesced - it is alive and deliberately refusing writes for a maintenance window, which may last minutes. Giving up after three attempts would guarantee the divergence that the retry exists to prevent.
FailureClassifier.Verdict.QUIESCED verdict switches to the long budget, and an
FailureClassifier.Verdict.APPLICATION_ERROR stops immediately, because it will be rejected
identically forever.
Bounded, and loudly so
Virtual threads make retrying cheap in threads but not in memory: every pending mutation is a retained object, and a cluster that stays down for an hour would otherwise turn into a heap exhaustion. Past the capacity, work is dropped with a warning and a counter - a cluster missing data is bad, and an unreadable heap dump is worse.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceRe-applies one mutation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Gives queued work a short window to land, then stops.longdropped()Mutations discarded because the queue was full - non-zero means a cluster is missing data.booleanWaits for the queue to drain.intpending()Mutations still waiting to be applied somewhere.booleansubmit(String clusterName, String operationName, DeferredMutations.Retryable task, int capacity, RetryPolicy policy) Queues one mutation for retry against one cluster.
-
Constructor Details
-
DeferredMutations
-
-
Method Details
-
submit
public boolean submit(String clusterName, String operationName, DeferredMutations.Retryable task, int capacity, RetryPolicy policy) Queues one mutation for retry against one cluster.- Parameters:
clusterName- the cluster that owes this mutationoperationName- the operation, for logstask- re-applies the mutation; may throw whatever the space throwscapacity- maximum pending mutations across all clusterspolicy- the starting retry budget, escalated automatically if the cluster is quiesced- Returns:
falseif the queue was full and the work was dropped
-
pending
public int pending()Mutations still waiting to be applied somewhere. -
dropped
public long dropped()Mutations discarded because the queue was full - non-zero means a cluster is missing data. -
flush
Waits for the queue to drain.- Returns:
trueif everything landed within the timeout- Throws:
InterruptedException
-
close
public void close()Gives queued work a short window to land, then stops. Waiting forever would hang a shutdown; going immediately would discard data silently - so it waits, then says what was left.- Specified by:
closein interfaceAutoCloseable
-