Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Hazelcast, Second Edition

You're reading from  Getting Started with Hazelcast, Second Edition

Product type Book
Published in Jul 2015
Publisher Packt
ISBN-13 9781785285332
Pages 162 pages
Edition 1st Edition
Languages
Author (1):
Matthew Johns Matthew Johns
Profile icon Matthew Johns

Table of Contents (19) Chapters

Getting Started with Hazelcast Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. What is Hazelcast? 2. Getting off the Ground 3. Going Concurrent 4. Divide and Conquer 5. Listening Out 6. Spreading the Load 7. Gathering Results 8. Typical Deployments 9. From the Outside Looking In 10. Going Global 11. Playing Well with Others Configuration Summary Index

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 IExecutorService interface to provide a more flexible control over 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, as follows:

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

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

Callable<String> timeTask = new TimeInstanceAwareCallable();

Member member = <target member>;

Future<String> specificTask...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}