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

Extending quorum


We previously saw how we can configure a simple cluster health check to ensure that a given number of nodes were present to support the application. However, should we need more detailed control over the quorum definition beyond a simple node count check, we can create our own quorum function that will allow us to programmatically define what it means to be healthy. This can be as simple or as complex as what the application requires. In the following example, we sourced an expected cluster size (probably from a suitable location than a hard-coded) and dynamically checked whether a majority of the nodes are present:

public class QuorumExample {
  public static void main(String[] args) throws Exception {
    QuorumConfig quorumConf = new QuorumConfig();
    quorumConf.setName("atLeastTwoNodesWithMajority");
    quorumConf.setEnabled(true);
    quorumConf.setType(QuorumType.WRITE);

    final int expectedClusterSize = 5;
    quorumConf.setQuorumFunctionImplementation(
    ...
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 $15.99/month. Cancel anytime}