Package com.hazelcast.core

Examples of com.hazelcast.core.LifecycleListener


        ClientConfig clientConfig = new ClientConfig();
        clientConfig.getNetworkConfig().setRedoOperation(true);

        final HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
        final CountDownLatch connectedLatch = new CountDownLatch(2);
        client.getLifecycleService().addLifecycleListener(new LifecycleListener() {
            @Override
            public void stateChanged(LifecycleEvent event) {
                connectedLatch.countDown();
            }
        });
View Full Code Here


        list.offer(LifecycleState.CLIENT_CONNECTED);


        final HazelcastInstance instance = Hazelcast.newHazelcastInstance();
        final CountDownLatch latch = new CountDownLatch(list.size());
        LifecycleListener listener = new LifecycleListener() {
            public void stateChanged(LifecycleEvent event) {
                final LifecycleState state = list.poll();
                if (state != null && state.equals(event.getState())) {
                    latch.countDown();
                }
View Full Code Here

    c4.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(clusterTwoMembers);

    c4.setProperty(GroupProperties.PROP_WAIT_SECONDS_BEFORE_JOIN, "0");

    final CountDownLatch latch = new CountDownLatch(1);
    c4.addListenerConfig(new ListenerConfig(new LifecycleListener() {
      public void stateChanged(final LifecycleEvent event) {
        if(event.getState() == LifecycleState.MERGED) {
          System.out.println("h4 restarted");
          latch.countDown();
        }
View Full Code Here

          // member of the cluster.
          h1.getMap("h").put(ensureKeyInHost(h1, m1), "m1");
          h1.getMap("h").put(ensureKeyInHost(h1, m2), "m2");
         
          final CountDownLatch latch = new CountDownLatch(2);
          c1.addListenerConfig(new ListenerConfig(new LifecycleListener() {
              public void stateChanged(final LifecycleEvent event) {
                System.out.println(event.getState());
                  if (event.getState() == LifecycleState.MERGED) {
                      System.out.println("h1 restarted");
                      latch.countDown();
                  }
              }
          }));
 
          c1.addListenerConfig(new ListenerConfig(new LifecycleListener() {
              public void stateChanged(final LifecycleEvent event) {
                System.out.println(event.getState());
                  if (event.getState() == LifecycleState.MERGED) {
                      System.out.println("h2 restarted");
                      latch.countDown();
View Full Code Here

          c4.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(clusterTwoMembers);
 
          c4.setProperty(GroupProperties.PROP_WAIT_SECONDS_BEFORE_JOIN, "0");
 
          final CountDownLatch latch = new CountDownLatch(2);
          c3.addListenerConfig(new ListenerConfig(new LifecycleListener() {
              public void stateChanged(final LifecycleEvent event) {
                  if (event.getState() == LifecycleState.MERGED) {
                      System.out.println("h3 restarted");
                      latch.countDown();
                  }
              }
          }));
 
          c4.addListenerConfig(new ListenerConfig(new LifecycleListener() {
              public void stateChanged(final LifecycleEvent event) {
                  if (event.getState() == LifecycleState.MERGED) {
                      System.out.println("h4 restarted");
                      latch.countDown();
                  }
View Full Code Here

 
          final HazelcastInstance h1 = Hazelcast.newHazelcastInstance(c1);
          final HazelcastInstance h2 = Hazelcast.newHazelcastInstance(c2);
 
          final CountDownLatch latch = new CountDownLatch(1);
          c3.addListenerConfig(new ListenerConfig(new LifecycleListener() {
              public void stateChanged(final LifecycleEvent event) {
                  if (event.getState() == LifecycleState.MERGED) {
                      h1.getLifecycleService().shutdown();
                  } else if (event.getState() == LifecycleState.MERGED) {
                      System.out.println("h3 restarted");
View Full Code Here

TOP

Related Classes of com.hazelcast.core.LifecycleListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.