Future¶
-
class
Future
¶ Bases:
object
Future is used for representing an asynchronous computation result.
-
logger
= <logging.Logger object>¶
-
set_result
(result)¶ Sets the result of the Future.
Parameters: result – Result of the Future.
-
set_exception
(exception, traceback=None)¶ Sets the exception for this Future in case of errors.
Parameters: - exception – (Exception), exception to be threw in case of error.
- traceback – (Function), function to be called on traceback (optional).
-
result
()¶ Returns the result of the Future, which makes the call synchronous if the result has not been computed yet.
Returns: Result of the Future.
-
is_success
()¶ Determines whether the result can be successfully computed or not.
-
done
()¶ Determines whether the result is computed or not.
Returns: (bool), true
if the result is computed,false
otherwise.
-
running
()¶ Determines whether the asynchronous call, the computation is still running or not.
Returns: (bool), true
if the result is being computed,false
otherwise.
-
exception
()¶ Throws exception. :return: (Exception), exception of this Future.
-
traceback
()¶ Traceback function for the Future.
-
add_done_callback
(callback)¶
-
continue_with
(continuation_func, *args)¶ Create a continuation that executes when the Future is completed.
Parameters: continuation_func – A function which takes the future as the only parameter. Return value of the function will be set as the result of the continuation future. :return: A new Future which will be completed when the continuation is done.
-
-
class
ImmediateFuture
(result)¶ Bases:
hazelcast.future.Future
-
set_exception
(exception)¶ Sets the exception for this Future in case of errors.
Parameters: - exception – (Exception), exception to be threw in case of error.
- traceback – (Function), function to be called on traceback (optional).
-
set_result
(result)¶ Sets the result of the Future.
Parameters: result – Result of the Future.
-
done
()¶ Determines whether the result is computed or not.
Returns: (bool), true
if the result is computed,false
otherwise.
-
is_success
()¶ Determines whether the result can be successfully computed or not.
-
exception
()¶ Throws exception. :return: (Exception), exception of this Future.
-
traceback
()¶ Traceback function for the Future.
-
result
()¶ Returns the result of the Future, which makes the call synchronous if the result has not been computed yet.
Returns: Result of the Future.
-
add_done_callback
(callback)¶
-
-
class
ImmediateExceptionFuture
(exception, traceback=None)¶ Bases:
hazelcast.future.Future
-
set_exception
(exception, traceback=None)¶ Sets the exception for this Future in case of errors.
Parameters: - exception – (Exception), exception to be threw in case of error.
- traceback – (Function), function to be called on traceback (optional).
-
set_result
(result)¶ Sets the result of the Future.
Parameters: result – Result of the Future.
-
done
()¶ Determines whether the result is computed or not.
Returns: (bool), true
if the result is computed,false
otherwise.
-
is_success
()¶ Determines whether the result can be successfully computed or not.
-
exception
()¶ Throws exception. :return: (Exception), exception of this Future.
-
traceback
()¶ Traceback function for the Future.
-
result
()¶ Returns the result of the Future, which makes the call synchronous if the result has not been computed yet.
Returns: Result of the Future.
-
add_done_callback
(callback)¶
-
-
combine_futures
(*futures)¶ Combines set of Futures.
Parameters: futures – (Futures), Futures to be combined. Returns: Result of the combination.
-
make_blocking
(instance)¶ Takes an instance and returns an object whose methods which return non-blocking Future become blocking calls. :param instance: (object), a non-blocking instance. :return: (object), blocking version of given non-blocking instance.