Class MongoConcurrentUtils
java.lang.Object
dev.getelements.elements.dao.mongo.MongoConcurrentUtils
Deprecated.
This was written before MongoDB transactions were available. Use transactions instead.
A class that helps reduce the boilerplate code when atomic operations are necessary.
Created by patricktwohig on 3/29/15.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.Thrown when there is too much contention over a particular resource.static classDeprecated.Thrown when the operation fails.static interfaceDeprecated.A basic a atomic operation.static classDeprecated.General exception type for a failure of an Optimistic operation. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<ReturnT> ReturnTperformOptimistic(MongoConcurrentUtils.CriticalOperation<ReturnT> criticalOperation) Deprecated.Attempts to complete the given criticalOperation and, in the event of a failure, attempts to retry the criticalOperation several times until giving up.<ReturnT,ExceptionT extends Throwable>
ReturnTperformOptimistic(MongoConcurrentUtils.CriticalOperation<ReturnT> criticalOperation, Supplier<ExceptionT> exceptionTSupplier) Deprecated.Attempts to complete the given criticalOperation and, in the event of a failure, attempts to retry the criticalOperation several times until giving up.
-
Field Details
-
OPTIMISTIC_RETRY_COUNT
Deprecated.- See Also:
-
FALLOFF_TIME_MIN_MS
Deprecated.Defines the minimum time an optimistic operation will wait before retrying.- See Also:
-
FALLOFF_TIME_MAX_MS
Deprecated.Defines the maximum time an optimistic operation will wait before retrying.- See Also:
-
-
Constructor Details
-
MongoConcurrentUtils
public MongoConcurrentUtils()Deprecated.
-
-
Method Details
-
performOptimistic
public <ReturnT> ReturnT performOptimistic(MongoConcurrentUtils.CriticalOperation<ReturnT> criticalOperation) throws MongoConcurrentUtils.ConflictException Deprecated.Attempts to complete the given criticalOperation and, in the event of a failure, attempts to retry the criticalOperation several times until giving up.- Type Parameters:
ReturnT- the type to return- Parameters:
criticalOperation- the criticalOperation to attempt- Returns:
- the return fields from the HttpOperation
- Throws:
MongoConcurrentUtils.ConflictException
-
performOptimistic
public <ReturnT,ExceptionT extends Throwable> ReturnT performOptimistic(MongoConcurrentUtils.CriticalOperation<ReturnT> criticalOperation, Supplier<ExceptionT> exceptionTSupplier) throws ExceptionT Deprecated.Attempts to complete the given criticalOperation and, in the event of a failure, attempts to retry the criticalOperation several times until giving up.- Type Parameters:
ReturnT- the type to return- Parameters:
criticalOperation- the criticalOperation to attempt- Returns:
- the return fields from the HttpOperation
- Throws:
ExceptionT
-