Hazelcast C++ Client
Classes | Public Member Functions | Static Public Attributes | Friends | List of all members
hazelcast::client::IExecutorService Class Reference

Distributed implementation of java.util.concurrent.ExecutorService. More...

#include <IExecutorService.h>

+ Inheritance diagram for hazelcast::client::IExecutorService:

Public Member Functions

template<typename HazelcastSerializable >
void execute (const HazelcastSerializable &command)
 Executes the given command at some time in the future. More...
 
template<typename HazelcastSerializable >
void execute (const HazelcastSerializable &command, const cluster::memberselector::MemberSelector &memberSelector)
 Executes a task on a randomly selected member. More...
 
template<typename HazelcastSerializable , typename K >
void executeOnKeyOwner (const HazelcastSerializable &command, const K &key)
 Executes a task on the owner of the specified key. More...
 
template<typename HazelcastSerializable >
void executeOnMember (const HazelcastSerializable &command, const Member &member)
 Executes a task on the specified member. More...
 
template<typename HazelcastSerializable >
void executeOnMembers (const HazelcastSerializable &command, const std::vector< Member > &members)
 Executes a task on each of the specified members. More...
 
template<typename HazelcastSerializable >
void executeOnMembers (const HazelcastSerializable &command, const cluster::memberselector::MemberSelector &memberSelector)
 Executes a task on each of the selected members. More...
 
template<typename HazelcastSerializable >
void executeOnAllMembers (const HazelcastSerializable &command)
 Executes a task on all of the known cluster members. More...
 
template<typename HazelcastSerializable , typename T , typename K >
boost::shared_ptr< ICompletableFuture< T > > submitToKeyOwner (const HazelcastSerializable &task, const K &key)
 Submits a task to the owner of the specified key and returns a ICompletableFuture representing that task. More...
 
template<typename HazelcastSerializable , typename T >
boost::shared_ptr< ICompletableFuture< T > > submitToMember (const HazelcastSerializable &task, const Member &member)
 Submits a task to the specified member and returns a ICompletableFuture representing that task. More...
 
template<typename HazelcastSerializable , typename T >
std::map< Member, boost::shared_ptr< ICompletableFuture< T > > > submitToMembers (const HazelcastSerializable &task, const std::vector< Member > &members)
 Submits a task to given members and returns map of Member-ICompletableFuture pairs representing pending completion of the task on each member. More...
 
template<typename HazelcastSerializable , typename T >
std::map< Member, boost::shared_ptr< ICompletableFuture< T > > > submitToMembers (const HazelcastSerializable &task, const cluster::memberselector::MemberSelector &memberSelector)
 Submits a task to selected members and returns a map of Member-ICompletableFuture pairs representing pending completion of the task on each member. More...
 
template<typename HazelcastSerializable , typename T >
std::map< Member, boost::shared_ptr< ICompletableFuture< T > > > submitToAllMembers (const HazelcastSerializable &task)
 Submits task to all cluster members and returns a map of Member-ICompletableFuture pairs representing pending completion of the task on each member. More...
 
template<typename HazelcastSerializable , typename T >
boost::shared_ptr< ICompletableFuture< T > > submit (const HazelcastSerializable &task, const boost::shared_ptr< T > &result)
 Submits a task for execution and returns a ICompletableFuture representing that task. More...
 
template<typename HazelcastSerializable , typename T >
boost::shared_ptr< ICompletableFuture< T > > submit (const HazelcastSerializable &task)
 Submits a value-returning task for execution and returns a ICompletableFuture representing the pending results of the task. More...
 
template<typename HazelcastSerializable , typename T >
void submit (const HazelcastSerializable &task, const boost::shared_ptr< ExecutionCallback< T > > &callback)
 Submits a task to a random member. More...
 
template<typename HazelcastSerializable , typename T >
boost::shared_ptr< ICompletableFuture< T > > submit (const HazelcastSerializable &task, const cluster::memberselector::MemberSelector &memberSelector)
 Submits a task to a randomly selected member and returns a ICompletableFuture representing that task. More...
 
template<typename HazelcastSerializable , typename T >
void submit (const HazelcastSerializable &task, const cluster::memberselector::MemberSelector &memberSelector, const boost::shared_ptr< ExecutionCallback< T > > &callback)
 Submits a task to randomly selected members. More...
 
template<typename HazelcastSerializable , typename T , typename K >
void submitToKeyOwner (const HazelcastSerializable &task, const K &key, const boost::shared_ptr< ExecutionCallback< T > > &callback)
 Submits a task to the owner of the specified key. More...
 
template<typename HazelcastSerializable , typename T >
void submitToMember (const HazelcastSerializable &task, const Member &member, const boost::shared_ptr< ExecutionCallback< T > > &callback)
 Submits a task to the specified member. More...
 
template<typename HazelcastSerializable , typename T >
void submitToMembers (const HazelcastSerializable &task, const std::vector< Member > &members, const boost::shared_ptr< MultiExecutionCallback< T > > &callback)
 Submits a task to the specified members. More...
 
template<typename HazelcastSerializable , typename T >
void submitToMembers (const HazelcastSerializable &task, const cluster::memberselector::MemberSelector &memberSelector, const boost::shared_ptr< MultiExecutionCallback< T > > &callback)
 Submits task to the selected members. More...
 
template<typename HazelcastSerializable , typename T >
void submitToAllMembers (const HazelcastSerializable &task, const boost::shared_ptr< MultiExecutionCallback< T > > &callback)
 Submits task to all the cluster members. More...
 
void shutdown ()
 Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. More...
 
bool isShutdown ()
 Returns. More...
 
bool isTerminated ()
 Returns. More...
 

Static Public Attributes

static const std::string SERVICE_NAME = "hz:impl:executorService"
 

Friends

class executor::impl::ExecutorServiceProxyFactory
 

Detailed Description

Distributed implementation of java.util.concurrent.ExecutorService.

IExecutorService provides additional methods like executing tasks on a specific member, on a member who is owner of a specific key, executing a tasks on multiple members and listening execution result using a callback.

See also
ExecutionCallback
MultiExecutionCallback

Member Function Documentation

◆ execute() [1/2]

template<typename HazelcastSerializable >
void hazelcast::client::IExecutorService::execute ( const HazelcastSerializable &  command)
inline

Executes the given command at some time in the future.

The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the

Executor

implementation.

Parameters
commandthe runnable task
Exceptions
RejectedExecutionExceptionif this task cannot be accepted for execution

◆ execute() [2/2]

template<typename HazelcastSerializable >
void hazelcast::client::IExecutorService::execute ( const HazelcastSerializable &  command,
const cluster::memberselector::MemberSelector memberSelector 
)
inline

Executes a task on a randomly selected member.

Parameters
commandthe task that is executed on a randomly selected member
memberSelectormemberSelector
Exceptions
RejectedExecutionExceptionif no member is selected

◆ executeOnAllMembers()

template<typename HazelcastSerializable >
void hazelcast::client::IExecutorService::executeOnAllMembers ( const HazelcastSerializable &  command)
inline

Executes a task on all of the known cluster members.

Parameters
commanda task executed on all of the known cluster members

◆ executeOnKeyOwner()

template<typename HazelcastSerializable , typename K >
void hazelcast::client::IExecutorService::executeOnKeyOwner ( const HazelcastSerializable &  command,
const K &  key 
)
inline

Executes a task on the owner of the specified key.

Parameters
commanda task executed on the owner of the specified key
keythe specified key

◆ executeOnMember()

template<typename HazelcastSerializable >
void hazelcast::client::IExecutorService::executeOnMember ( const HazelcastSerializable &  command,
const Member member 
)
inline

Executes a task on the specified member.

Parameters
commandthe task executed on the specified member
memberthe specified member

◆ executeOnMembers() [1/2]

template<typename HazelcastSerializable >
void hazelcast::client::IExecutorService::executeOnMembers ( const HazelcastSerializable &  command,
const std::vector< Member > &  members 
)
inline

Executes a task on each of the specified members.

Parameters
commandthe task executed on the specified members
membersthe specified members

◆ executeOnMembers() [2/2]

template<typename HazelcastSerializable >
void hazelcast::client::IExecutorService::executeOnMembers ( const HazelcastSerializable &  command,
const cluster::memberselector::MemberSelector memberSelector 
)
inline

Executes a task on each of the selected members.

Parameters
commanda task executed on each of the selected members
memberSelectormemberSelector
Exceptions
RejectedExecutionExceptionif no member is selected

◆ isShutdown()

bool hazelcast::client::IExecutorService::isShutdown ( )

Returns.

true

if this executor has been shut down.

Returns
true
if this executor has been shut down

◆ isTerminated()

bool hazelcast::client::IExecutorService::isTerminated ( )

Returns.

true

if all tasks have completed following shut down. Note that

is never

true

unless either

.

Returns
true
if all tasks have completed following shut down

◆ shutdown()

void hazelcast::client::IExecutorService::shutdown ( )

Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.

Invocation has no additional effect if already shut down.

This method does not wait for previously submitted tasks to complete execution.

◆ submit() [1/5]

template<typename HazelcastSerializable , typename T >
boost::shared_ptr<ICompletableFuture<T> > hazelcast::client::IExecutorService::submit ( const HazelcastSerializable &  task,
const boost::shared_ptr< T > &  result 
)
inline

Submits a task for execution and returns a ICompletableFuture representing that task.

The ICompletableFuture's

method will return the given result upon successful completion.

Parameters
taskthe task to submit
resultthe result to return
<T>the type of the result
Returns
a ICompletableFuture representing pending completion of the task
Exceptions
RejectedExecutionExceptionif the task cannot be scheduled for execution
NullPointerExceptionif the task is null

◆ submit() [2/5]

template<typename HazelcastSerializable , typename T >
boost::shared_ptr<ICompletableFuture<T> > hazelcast::client::IExecutorService::submit ( const HazelcastSerializable &  task)
inline

Submits a value-returning task for execution and returns a ICompletableFuture representing the pending results of the task.

The ICompletableFuture's

method will return the task's result upon successful completion.

If you would like to immediately block waiting for a task, you can use constructions of the form

result = exec->submit<HazelcastSerializable, T>(aCallable)->get();
Parameters
taskthe task to submit
<T>the type of the task's result
Returns
a ICompletableFuture representing pending completion of the task
Exceptions
RejectedExecutionExceptionif the task cannot be scheduled for execution

◆ submit() [3/5]

template<typename HazelcastSerializable , typename T >
void hazelcast::client::IExecutorService::submit ( const HazelcastSerializable &  task,
const boost::shared_ptr< ExecutionCallback< T > > &  callback 
)
inline

Submits a task to a random member.

Caller will be notified of the result of the task by ExecutionCallback<T>::onResponse() or ExecutionCallback<T>::onFailure(exception::IException).

Parameters
taska task submitted to a random member
callbackcallback
<T>the response type of callback

◆ submit() [4/5]

template<typename HazelcastSerializable , typename T >
boost::shared_ptr<ICompletableFuture<T> > hazelcast::client::IExecutorService::submit ( const HazelcastSerializable &  task,
const cluster::memberselector::MemberSelector memberSelector 
)
inline

Submits a task to a randomly selected member and returns a ICompletableFuture representing that task.

Parameters
tasktask submitted to a randomly selected member
memberSelectormemberSelector
<T>the result type of callable
Returns
a ICompletableFuture representing pending completion of the task
Exceptions
RejectedExecutionExceptionif no member is selected

◆ submit() [5/5]

template<typename HazelcastSerializable , typename T >
void hazelcast::client::IExecutorService::submit ( const HazelcastSerializable &  task,
const cluster::memberselector::MemberSelector memberSelector,
const boost::shared_ptr< ExecutionCallback< T > > &  callback 
)
inline

Submits a task to randomly selected members.

Caller will be notified for the result of the task by ExecutionCallback<T>::onResponse() or ExecutionCallback<T>::onFailure(exception::IException).

Parameters
taskthe task submitted to randomly selected members
memberSelectormemberSelector
callbackcallback
<T>the response type of callback
Exceptions
RejectedExecutionExceptionif no member is selected

◆ submitToAllMembers() [1/2]

template<typename HazelcastSerializable , typename T >
std::map<Member, boost::shared_ptr<ICompletableFuture<T> > > hazelcast::client::IExecutorService::submitToAllMembers ( const HazelcastSerializable &  task)
inline

Submits task to all cluster members and returns a map of Member-ICompletableFuture pairs representing pending completion of the task on each member.

Parameters
taskthe task submitted to all cluster members
<T>the result type of callable
Returns
map of Member-ICompletableFuture pairs representing pending completion of the task on each member

◆ submitToAllMembers() [2/2]

template<typename HazelcastSerializable , typename T >
void hazelcast::client::IExecutorService::submitToAllMembers ( const HazelcastSerializable &  task,
const boost::shared_ptr< MultiExecutionCallback< T > > &  callback 
)
inline

Submits task to all the cluster members.

Caller will be notified for the result of each task by MultiExecutionCallback#onResponse(const Member &, const boost::shared_ptr<V> &), and when all tasks are completed, MultiExecutionCallback#onComplete(std::map) will be called.

Parameters
taskthe task submitted to all the cluster members
callbackcallback

◆ submitToKeyOwner() [1/2]

template<typename HazelcastSerializable , typename T , typename K >
boost::shared_ptr<ICompletableFuture<T> > hazelcast::client::IExecutorService::submitToKeyOwner ( const HazelcastSerializable &  task,
const K &  key 
)
inline

Submits a task to the owner of the specified key and returns a ICompletableFuture representing that task.

Parameters
tasktask submitted to the owner of the specified key
keythe specified key
<T>the result type of callable
Returns
a ICompletableFuture representing pending completion of the task

◆ submitToKeyOwner() [2/2]

template<typename HazelcastSerializable , typename T , typename K >
void hazelcast::client::IExecutorService::submitToKeyOwner ( const HazelcastSerializable &  task,
const K &  key,
const boost::shared_ptr< ExecutionCallback< T > > &  callback 
)
inline

Submits a task to the owner of the specified key.

Caller will be notified for the result of the task by ExecutionCallback<T>::onResponse() or ExecutionCallback<T>::onFailure(exception::IException).

Parameters
tasktask submitted to the owner of the specified key
keythe specified key
callbackcallback
<T>the response type of callback

◆ submitToMember() [1/2]

template<typename HazelcastSerializable , typename T >
boost::shared_ptr<ICompletableFuture<T> > hazelcast::client::IExecutorService::submitToMember ( const HazelcastSerializable &  task,
const Member member 
)
inline

Submits a task to the specified member and returns a ICompletableFuture representing that task.

Parameters
taskthe task submitted to the specified member
memberthe specified member
<T>the result type of callable
Returns
a ICompletableFuture representing pending completion of the task

◆ submitToMember() [2/2]

template<typename HazelcastSerializable , typename T >
void hazelcast::client::IExecutorService::submitToMember ( const HazelcastSerializable &  task,
const Member member,
const boost::shared_ptr< ExecutionCallback< T > > &  callback 
)
inline

Submits a task to the specified member.

Caller will be notified for the result of the task by ExecutionCallback<T>::onResponse() or ExecutionCallback<T>::onFailure(exception::IException).

Parameters
taskthe task submitted to the specified member
memberthe specified member
callbackcallback
<T>the response type of callback

◆ submitToMembers() [1/4]

template<typename HazelcastSerializable , typename T >
std::map<Member, boost::shared_ptr<ICompletableFuture<T> > > hazelcast::client::IExecutorService::submitToMembers ( const HazelcastSerializable &  task,
const std::vector< Member > &  members 
)
inline

Submits a task to given members and returns map of Member-ICompletableFuture pairs representing pending completion of the task on each member.

Parameters
taskthe task submitted to given members
membersthe given members
<T>the result type of callable
Returns
map of Member-ICompletableFuture pairs representing pending completion of the task on each member

◆ submitToMembers() [2/4]

template<typename HazelcastSerializable , typename T >
std::map<Member, boost::shared_ptr<ICompletableFuture<T> > > hazelcast::client::IExecutorService::submitToMembers ( const HazelcastSerializable &  task,
const cluster::memberselector::MemberSelector memberSelector 
)
inline

Submits a task to selected members and returns a map of Member-ICompletableFuture pairs representing pending completion of the task on each member.

Parameters
taskthe task submitted to selected members
memberSelectormemberSelector
<T>the result type of callable
Returns
map of Member-ICompletableFuture pairs representing pending completion of the task on each member
Exceptions
RejectedExecutionExceptionif no member is selected

◆ submitToMembers() [3/4]

template<typename HazelcastSerializable , typename T >
void hazelcast::client::IExecutorService::submitToMembers ( const HazelcastSerializable &  task,
const std::vector< Member > &  members,
const boost::shared_ptr< MultiExecutionCallback< T > > &  callback 
)
inline

Submits a task to the specified members.

Caller will be notified for the result of the each task by MultiExecutionCallback#onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback#onComplete(std::vector) will be called.

Parameters
taskthe task submitted to the specified members
membersthe specified members
callbackcallback

◆ submitToMembers() [4/4]

template<typename HazelcastSerializable , typename T >
void hazelcast::client::IExecutorService::submitToMembers ( const HazelcastSerializable &  task,
const cluster::memberselector::MemberSelector memberSelector,
const boost::shared_ptr< MultiExecutionCallback< T > > &  callback 
)
inline

Submits task to the selected members.

Caller will be notified for the result of the each task by MultiExecutionCallback#onResponse(Member, Object), and when all tasks are completed, MultiExecutionCallback#onComplete(std::map) will be called.

Parameters
taskthe task submitted to the selected members
memberSelectormemberSelector
callbackcallback
Exceptions
RejectedExecutionExceptionif no member is selected

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