Class AbstractLocalClusterOperationData
java.lang.Object
com.gigaspaces.internal.cluster.node.impl.gateway.sink.AbstractLocalClusterOperationData
- All Implemented Interfaces:
DataConflictOperation,DataSyncOperation
- Direct Known Subclasses:
AbstractLocalClusterWriteOperationData,LocalClusterChangeOperationData,LocalClusterRemoveByUIDOperationData
public abstract class AbstractLocalClusterOperationData
extends Object
implements DataConflictOperation
A base class for Local Cluster operations data. Operation data instances are created after a
gateway Sink component receives a replication batch of operations to execute and each operation
is translated to a local cluster operation, which eventually uses an
ISpaceProxy instance
for executing the operations against the local cluster.
Batch supported operations will merged together in order to gain better performance by using
writeMultiple etc..- Since:
- 8.0.3
- Author:
- idan
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.gigaspaces.cluster.replication.gateway.conflict.DataConflictOperation
DataConflictOperation.OperationType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected ConflictCauseprotected List<AbstractLocalClusterOperationData>protected ConflictCauseAfter each execution the execution result is reset.protected intprotected final ISpaceProxy -
Constructor Summary
ConstructorsConstructorDescriptionAbstractLocalClusterOperationData(ISpaceProxy spaceProxy, ITypeDesc typeDescriptor) -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Determines that the operation will be aborted.voidaddPendingOperation(AbstractLocalClusterOperationData operationData) Add anAbstractLocalClusterOperationDatato the current instance (merge for execution).protected ConflictCauseabstract booleanexecute(Transaction transaction) Executes the operation against the providedISpaceProxywith the providedTransactioninstance.intprotected intbooleanprotected voidprotected voidbooleanprotected booleanprotected booleanisRetryable(int maximumRetries) booleanisSameOperationType(AbstractLocalClusterOperationData operationData) voidoverride()Determines that the operation will be overridden.protected voidvoidreset()voidsetConflictCause(ConflictCause conflictCause) booleanabstract booleanbooleantoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.gigaspaces.cluster.replication.gateway.conflict.DataConflictOperation
getOperationEntry, getOperationType, supportsOverrideMethods inherited from interface com.gigaspaces.sync.DataSyncOperation
getDataAsDocument, getDataAsObject, getDataSyncOperationType, getSpaceId, getUid, supportsDataAsDocument, supportsDataAsObject, supportsGetSpaceId
-
Field Details
-
_pendingOperations
-
_conflictCause
-
_aborted
protected boolean _aborted -
_spaceProxy
-
_retriesCount
protected int _retriesCount -
_previousConflictCause
After each execution the execution result is reset. We need the conflict cause to be kept for the next execution.
-
-
Constructor Details
-
AbstractLocalClusterOperationData
-
-
Method Details
-
isSameOperationType
- Returns:
- true if the provided
AbstractLocalClusterOperationDatais of the same class type.
-
addPendingOperation
Add anAbstractLocalClusterOperationDatato the current instance (merge for execution).- Parameters:
operationData- TheAbstractLocalClusterOperationDatato add.
-
execute
Executes the operation against the providedISpaceProxywith the providedTransactioninstance.- Parameters:
transaction- TheTransactionto with the operations.- Throws:
Exception
-
supportsBatching
public abstract boolean supportsBatching()- Returns:
- true if the operation supports batching.
-
reset
public void reset() -
overrideImpl
protected void overrideImpl() -
override
public void override()Description copied from interface:DataConflictOperationDetermines that the operation will be overridden. This can only be used if theDataConflictOperation.supportsOverride()returns true.It is possible to change the operation's entry data using the
DataSyncOperation.getDataAsObject()orDataSyncOperation.getDataAsDocument()methods.- Write operation with an
EntryAlreadyInSpaceConflictwill turn to an update operation. - Update operation with an
EntryNotInSpaceConflictwill turn to a write operation. - Update operation with an
EntryVersionConflictwill overwrite the entry in the target space. - Update operation with an
EntryLockedUnderTransactionConflictwill be retried.
- Specified by:
overridein interfaceDataConflictOperation
- Write operation with an
-
hasConflict
public boolean hasConflict()- Specified by:
hasConflictin interfaceDataConflictOperation- Returns:
- true if that operation had a conflict, otherwise false.
-
abort
public void abort()Description copied from interface:DataConflictOperationDetermines that the operation will be aborted. This can only be used if theDataConflictOperation.supportsAbort()returns true.- Specified by:
abortin interfaceDataConflictOperation
-
isAborted
public boolean isAborted() -
isOverriden
protected boolean isOverriden() -
toString
-
isRetryable
protected boolean isRetryable(int maximumRetries) -
incrementRetriesCounter
protected void incrementRetriesCounter() -
getRetriesCount
protected int getRetriesCount() -
getResolveAttempt
public int getResolveAttempt()- Specified by:
getResolveAttemptin interfaceDataConflictOperation- Returns:
- The current resolve attempt number for the operation.
-
incrementResolveAttempt
protected void incrementResolveAttempt() -
getConflictCause
- Specified by:
getConflictCausein interfaceDataConflictOperation- Returns:
- The
ConflictCauseinstance representing the conflict.
-
setConflictCause
-
convertExceptionToConflict
-
supportsAbort
public boolean supportsAbort()- Specified by:
supportsAbortin interfaceDataConflictOperation- Returns:
- true of aborting the operation is supported, otherwise false.
-
getResolutionDescription
-
getTypeDescriptor
- Specified by:
getTypeDescriptorin interfaceDataSyncOperation- Returns:
- the type descriptor of the data type. this can only be used if
DataSyncOperation.supportsGetTypeDescriptor()return true, otherwise an exception will be thrown.
-
supportsGetTypeDescriptor
public boolean supportsGetTypeDescriptor()- Specified by:
supportsGetTypeDescriptorin interfaceDataSyncOperation- Returns:
- whether this data operation support the
DataSyncOperation.getTypeDescriptor()operation.
-