Specifies a tuple to look for. If the old value is unmodified, replaces the existing tuple with the
specified value. If there is a mismatch returns the existing value. User does not need to do another get
to retrieve the current value in Space.
Namespace: Com.Tibco.As.SpaceAssembly: TIBCO.ActiveSpaces.Common (in TIBCO.ActiveSpaces.Common.dll) Version: 2.0.0.0 (2.4.0.001)
Syntax
C# |
---|
Tuple CompareAndPut( Tuple oldTuple, Tuple newTuple ) |
Visual Basic |
---|
Function CompareAndPut ( oldTuple As Tuple, newTuple As Tuple ) As Tuple |
Visual C++ |
---|
Tuple^ CompareAndPut( Tuple^ oldTuple, Tuple^ newTuple ) |
F# |
---|
abstract CompareAndPut : oldTuple : Tuple * newTuple : Tuple -> Tuple |
Parameters
- oldTuple
- Type: Com.Tibco.As.Space..::..Tuple
Old value. This tuple is allowed to be null. This indicates user wants the operation to be successful only if there is no value for it
- newTuple
- Type: Com.Tibco.As.Space..::..Tuple
New value to replace on success
Return Value
Type: TuplenewTuple on success, otherwise the current value in Space
Remarks
If operation is successful, return tuple will be same as newTuple passed in. Otherwise return will be
different object.
Tuple result = space.CompareAndPut(oldTuple, newTuple); if (result == newTuple) { /* operation is successful */ } else { /* operation failed due to mismatch */ }
Tuple result = space.CompareAndPut(oldTuple, newTuple); if (result == newTuple) { /* operation is successful */ } else { /* operation failed due to mismatch */ }