Hazelcast C++ Client
Public Member Functions | List of all members
hazelcast::client::IFuture< V > Class Template Referenceabstract

A. More...

#include <IFuture.h>

+ Inheritance diagram for hazelcast::client::IFuture< V >:

Public Member Functions

virtual bool cancel (bool mayInterruptIfRunning)=0
 Attempts to cancel execution of this task. More...
 
virtual bool isCancelled ()=0
 Returns. More...
 
virtual bool isDone ()=0
 Returns. More...
 
virtual boost::shared_ptr< V > get ()=0
 Waits if necessary for the computation to complete, and then retrieves its result. More...
 
virtual boost::shared_ptr< V > get (int64_t timeout, const TimeUnit &unit)=0
 Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available. More...
 

Detailed Description

template<typename V>
class hazelcast::client::IFuture< V >

A.

Future

represents the result of an asynchronous computation. Methods are provided to check if the computation is complete, to wait for its completion, and to retrieve the result of the computation. The result can only be retrieved using method

get

when the computation has completed, blocking if necessary until it is ready. Cancellation is performed by the

method. Additional methods are provided to determine if the task completed normally or was cancelled. Once a computation has completed, the computation cannot be cancelled.

Parameters
<V>The result type returned by this Future's
get
method

Member Function Documentation

◆ cancel()

template<typename V >
virtual bool hazelcast::client::IFuture< V >::cancel ( bool  mayInterruptIfRunning)
pure virtual

Attempts to cancel execution of this task.

This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when

is called, this task should never run. If the task has already started, then the

mayInterruptIfRunning

parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task.

After this method returns, subsequent calls to isDone will always return

true

. Subsequent calls to isCancelled will always return

true

if this method returned

true

.

Parameters
mayInterruptIfRunning

◆ get() [1/2]

template<typename V >
virtual boost::shared_ptr<V> hazelcast::client::IFuture< V >::get ( )
pure virtual

Waits if necessary for the computation to complete, and then retrieves its result.

Returns
the computed result
Exceptions
CancellationExceptionif the computation was cancelled
ExecutionExceptionif the computation threw an exception
InterruptedExceptionif the current thread was interrupted while waiting

◆ get() [2/2]

template<typename V >
virtual boost::shared_ptr<V> hazelcast::client::IFuture< V >::get ( int64_t  timeout,
const TimeUnit &  unit 
)
pure virtual

Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.

Parameters
timeoutthe maximum time to wait
unitthe time unit of the timeout argument
Returns
the computed result
Exceptions
CancellationExceptionif the computation was cancelled
ExecutionExceptionif the computation threw an exception
InterruptedExceptionif the current thread was interrupted while waiting
TimeoutExceptionif the wait timed out

◆ isCancelled()

template<typename V >
virtual bool hazelcast::client::IFuture< V >::isCancelled ( )
pure virtual

Returns.

true

if this task was cancelled before it completed normally.

Returns
true
if this task was cancelled before it completed

◆ isDone()

template<typename V >
virtual bool hazelcast::client::IFuture< V >::isDone ( )
pure virtual

Returns.

true

if this task completed.

Completion may be due to normal termination, an exception, or cancellation – in all of these cases, this method will return

true

.

Returns
true
if this task completed

The documentation for this class was generated from the following file: