Examples of WatchdogServiceImpl


Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

                checkHealth(watchdogService, Health.GREEN);
            }
        }, taskOwner);

  DataService dataService = createDataService(serviceProps);
  final WatchdogServiceImpl watchdog =
      new WatchdogServiceImpl(serviceProps, systemRegistry, txnProxy,
            dummyShutdownCtrl);
  try {
            txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    checkHealth(watchdogService, Health.GREEN);
                }
            }, taskOwner);

      watchdogService.shutdown();
      // wait for watchdog's renew to fail...
      Thread.sleep(renewTime * 4);

            txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    checkHealth(watchdog, Health.RED);
                }
            }, taskOwner);

  } finally {
      watchdog.shutdown();
      dataService.shutdown();
  }
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

  }
    }

    @Test(expected = IllegalStateException.class)
    public void testGetLocalNodeHealthServiceShuttingDown() throws Exception {
  WatchdogServiceImpl watchdog = new WatchdogServiceImpl(
      SgsTestNode.getDefaultProperties(
    "TestWatchdogServiceImpl", null, null),
      systemRegistry, txnProxy, dummyShutdownCtrl);
  watchdog.shutdown();
  watchdog.getLocalNodeHealth();
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

                }
            }
        }, taskOwner);

  DataService dataService = createDataService(serviceProps);
  final WatchdogServiceImpl watchdog =
      new WatchdogServiceImpl(serviceProps, systemRegistry, txnProxy,
            dummyShutdownCtrl);
  try {
            txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    if (! watchdogService.isLocalNodeAlive()) {
                        fail("Expected watchdogService.isLocalNodeAlive() " +
                             "to return true");
                    }
                }
            }, taskOwner);

      watchdogService.shutdown();
      // wait for watchdog's renew to fail...
      Thread.sleep(renewTime * 4);

            txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    if (watchdog.isLocalNodeAlive()) {
                        fail("Expected watchdogService.isLocalNodeAlive() " +
                             "to return false");
                    }
                }
            }, taskOwner);
     
  } finally {
      watchdog.shutdown();
      dataService.shutdown();
  }
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

  }
    }

    @Test(expected = IllegalStateException.class)
    public void testIsLocalNodeAliveServiceShuttingDown() throws Exception {
  WatchdogServiceImpl watchdog = new WatchdogServiceImpl(
      SgsTestNode.getDefaultProperties(
    "TestWatchdogServiceImpl", null, null),
      systemRegistry, txnProxy, dummyShutdownCtrl);
  watchdog.shutdown();
  watchdog.isLocalNodeAlive();
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

     "NonTransactional() to return true");
  }

  int port = watchdogService.getServer().getPort();
  DataService dataService = createDataService(serviceProps);
  WatchdogServiceImpl watchdog =
      new WatchdogServiceImpl(serviceProps, systemRegistry, txnProxy,
            dummyShutdownCtrl);
  try {
      if (! watchdog.isLocalNodeAliveNonTransactional()) {
    fail("Expected watchdog.isLocalNodeAliveNonTransactional() " +
         "to return true");
      }
      watchdogService.shutdown();
      // wait for watchdog's renew to fail...
      Thread.sleep(renewTime * 4);
      if (watchdog.isLocalNodeAliveNonTransactional()) {
    fail("Expected watchdog.isLocalNodeAliveNonTransactional() " +
         "to return false");
      }
     
  } finally {
      dataService.shutdown();
      watchdog.shutdown();
  }
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

    @Test(expected = IllegalStateException.class)
    public void testIsLocalNodeAliveNonTransactionalServiceShuttingDown()
  throws Exception
    {
  WatchdogServiceImpl watchdog = new WatchdogServiceImpl(
      SgsTestNode.getDefaultProperties(
    "TestWatchdogServiceImpl", null, null),
      systemRegistry, txnProxy, dummyShutdownCtrl);
  watchdog.shutdown();
  watchdog.isLocalNodeAliveNonTransactional();
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

        }
    }

    @Test(expected = IllegalStateException.class)
    public void testGetNodesServiceShuttingDown() throws Exception {
  final WatchdogServiceImpl watchdog = new WatchdogServiceImpl(
      SgsTestNode.getDefaultProperties(
    "TestWatchdogServiceImpl", null, null),
      systemRegistry, txnProxy, dummyShutdownCtrl);
  watchdog.shutdown();

        txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
        watchdog.getNodes();
                }
            }, taskOwner);
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

        }
    }

    @Test(expected = IllegalStateException.class)
    public void testGetNodeServiceShuttingDown() throws Exception {
  final WatchdogServiceImpl watchdog = new WatchdogServiceImpl(
      SgsTestNode.getDefaultProperties(
    "TestWatchdogServiceImpl", null, null),
      systemRegistry, txnProxy, dummyShutdownCtrl);
  watchdog.shutdown();
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
        watchdog.getNode(0);
                }
            }, taskOwner);
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

    @Test(expected = IllegalStateException.class)
    public void testAddNodeListenerServiceShuttingDown()
  throws Exception
    {
  final WatchdogServiceImpl watchdog = new WatchdogServiceImpl(
      SgsTestNode.getDefaultProperties(
    "TestWatchdogServiceImpl", null, null),
      systemRegistry, txnProxy, dummyShutdownCtrl);
  watchdog.shutdown();
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
            public void run() throws Exception {
    watchdog.addNodeListener(new DummyNodeListener());
            }
        }, taskOwner);
    }
View Full Code Here

Examples of com.sun.sgs.impl.service.watchdog.WatchdogServiceImpl

  try {
      for (int i = 0; i < 5; i++) {
    Properties props = SgsTestNode.getDefaultProperties(
        "TestWatchdogServiceImpl", serverNode, null);
    DataService dataService = createDataService(props);
    WatchdogServiceImpl watchdog =
        new WatchdogServiceImpl(props, systemRegistry, txnProxy,
              dummyShutdownCtrl);
    DummyNodeListener listener = new DummyNodeListener();
    watchdog.addNodeListener(listener);
    watchdogMap.put(
        watchdog, new WatchdogInfo(listener, dataService));
      }
 
      // shutdown watchdog server
      watchdogService.shutdown();

      Thread.sleep(renewTime * 4);

      for (WatchdogServiceImpl watchdog : watchdogMap.keySet()) {
    WatchdogInfo info = watchdogMap.get(watchdog);
    DummyNodeListener listener = info.listener;
    DataService dataService = info.dataService;
    Set<Node> nodes = listener.getFailedNodes();
    System.err.println(
        "failedNodes for " + dataService.getLocalNodeId() +
        ": " + nodes);
    if (nodes.size() != 6) {
        fail("Expected 6 failed nodes, got " + nodes.size());
    }
    for (Node node : nodes) {
        System.err.println(node);
        if (node.isAlive()) {
      fail("Node " + node.getId() + " is alive!");
        }
    }
      }
  } finally {
      for (WatchdogServiceImpl watchdog : watchdogMap.keySet()) {
    watchdog.shutdown();
    watchdogMap.get(watchdog).dataService.shutdown();
      }
  }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.