Reader small image

You're reading from  Getting Started with Hazelcast

Product typeBook
Published inAug 2013
Reading LevelBeginner
Publisher
ISBN-139781782167303
Edition1st Edition
Languages
Right arrow
Author (1)
Matthew Johns
Matthew Johns
author image
Matthew Johns

contacted on 6 may '16 ________ Matthew Johns is an agile software engineer and hands-on technical/solution architect; specialising in designing and delivering highly scaled and available distributed systems, with broad experience across the whole stack. He is the solution architect and lead engineer at Sky.
Read more about Matthew Johns

Right arrow

Running once, running everywhere


So far we've seen how we can gain access to a distributed executor service and submit our own tasks to it for execution; however, we might need a little more control as to where a task runs. Should we want to pin a particular task to a specific node, we can use the wrapper class DistributedTask to provide some signaling logic to the task manager so that it can detect and control which node the task is delegated to. You can find the details of the members in the cluster from the Cluster class, which is accessible from the HazelcastInstance class.

Config conf = new Config();
HazelcastInstance hz = Hazelcast.newHazelcastInstance(conf);

Member thisMember = hz.getCluster().getLocalMember();
Set<Member> clusterMembers = hz.getCluster().getMembers();
ExecutorService exec = hz.getExecutorService("exec");

Callable<String> timeTask = new TimeInstanceAwareCallable();

Member member = <target member>;
FutureTask<String> specificTask =
  new DistributedTask...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Getting Started with Hazelcast
Published in: Aug 2013Publisher: ISBN-13: 9781782167303

Author (1)

author image
Matthew Johns

contacted on 6 may '16 ________ Matthew Johns is an agile software engineer and hands-on technical/solution architect; specialising in designing and delivering highly scaled and available distributed systems, with broad experience across the whole stack. He is the solution architect and lead engineer at Sky.
Read more about Matthew Johns