Hazelcast C++ Client
|
This is a unique Future. More...
#include <Future.h>
Public Types | |
typedef std::auto_ptr< serialization::pimpl::Data >(* | Decoder) (protocol::ClientMessage &response) |
Public Member Functions | |
Future (connection::CallFuture &callFuture, serialization::pimpl::SerializationService &serializationService, Decoder decoder) | |
This constructor is only for internal use!!!! | |
Future (const Future &movedFuture) | |
This is actually a move constructor Constructs a Future with the shared state of movedFuture using move semantics. More... | |
Future & | operator= (const Future &movedFuture) |
Assigns the contents of another future object. More... | |
std::auto_ptr< V > | get () |
The get method waits until the future has a valid result and retrieves it. More... | |
future_status | wait_for (int64_t timeoutInMilliseconds) const |
Waits for the result to become available. More... | |
void | wait () const |
Blocks until the result becomes available. More... | |
bool | valid () const |
Checks if the future refers to a shared state. More... | |
This is a unique Future.
It can not be shared. The copy constructor actually moves and invalidates the moved from Future. It acts similar to std::future (avaialable since C++11)
This class in NOT THREAD SAFE. DO NOT use concurrently from multiple threads
|
inline |
This is actually a move constructor Constructs a Future with the shared state of movedFuture using move semantics.
After construction, movedFuture.valid() == false.
|
inline |
The get method waits until the future has a valid result and retrieves it.
It effectively calls wait() in order to wait for the result.
Important Note: get moves the result at the first call and hence it should not be called more than one time. The second call will result in undefined behaviour.
The behaviour is undefined if valid() is false before the call to this function (Our implementation throws FutureUninitialized). Any shared state is released. valid() is false after a call to this method.
one | of the hazelcast exceptions, if an exception was stored in the shared state referenced by the future |
|
inline |
Assigns the contents of another future object.
1) Releases any shared state and move-assigns the contents of movedFuture to *this. After the assignment, movedFuture.valid() == false and this->valid() will yield the same value as movedFuture.valid() before the assignment.
|
inline |
Checks if the future refers to a shared state.
This is the case only for futures that were not moved from until the first time get() is called.
|
inline |
|
inline |
Waits for the result to become available.
Blocks until specified timeout_duration has elapsed or the result becomes available, whichever comes first. Returns value identifies the state of the result. A steady clock is used to measure the duration. This function may block for longer than timeout_duration due to scheduling or resource contention delays.
The behaviour is undefined if valid()== false before the call to this function (Our implementation throws FutureUninitialized).
timeoutInMilliseconds | maximum duration in milliseconds to block for |