SpaceCompareAndPut Method (Tuple, Tuple) |
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.1.5.12)
SyntaxTuple CompareAndPut(
Tuple oldTuple,
Tuple newTuple
)
Function CompareAndPut (
oldTuple As Tuple,
newTuple As Tuple
) As Tuple
Tuple^ CompareAndPut(
Tuple^ oldTuple,
Tuple^ newTuple
)
abstract CompareAndPut :
oldTuple : Tuple *
newTuple : Tuple -> Tuple
Parameters
- oldTuple
- Type: Com.Tibco.As.SpaceTuple
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.SpaceTuple
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 */
}
See Also