Take any matching object from the space, returning null if there currently is none.
Equivalent to take, except that blocking is done only if necessary to wait for transactional state to settle.
Declaration Syntax
C# | Visual Basic | Visual C++ | J# |
T TakeIfExists<T>( IQuery<T> query, ITransaction tx )
Function TakeIfExists(Of T) ( _ query As IQuery(Of T), _ tx As ITransaction _ ) As T
generic<typename T> T TakeIfExists( IQuery<T>^ query, ITransaction^ tx )
Generic Template Parameters
- T
- Type of object to read.
Parameters
- query (IQuery<(Of <(T>)>))
- The query used for matching.
- tx (ITransaction)
- The transaction (if any) under which to work.
Return Value
The object taken from the space (null if no match was found).
Exceptions
Exception | Condition |
---|---|
UnusableEntryException | A serialized field of the object being read cannot be deserialized. |
TransactionException | Transaction error occured. |
InactiveSpaceException | The space is in backup mode and therefore is not active. |
EntryVersionConflictException | Operation is rejected as a result of optimistic locking version conflict. |
SqlQueryException | The query template is an illegal SqlQuery. |