Examples of WatchdogServiceImpl


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

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

    @Test(expected = IllegalStateException.class)
    public void testAddRecoveryListenerServiceShuttingDown()
  throws Exception
    {
  DataService dataService = createDataService(serviceProps);
  WatchdogServiceImpl watchdog = new WatchdogServiceImpl(
      serviceProps, systemRegistry, txnProxy, dummyShutdownCtrl);
  watchdog.shutdown();
  watchdog.addRecoveryListener(new DummyRecoveryListener());
  dataService.shutdown();
    }
View Full Code Here

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

  final String appName = "TestReportFailure";

  // Create a dummy shutdown controller to log calls to the shutdown
  // method. NOTE: The controller does not actually shutdown the node
  DataService dataService = createDataService(serviceProps);
  WatchdogServiceImpl watchdogService =
      new WatchdogServiceImpl(serviceProps, systemRegistry,
            txnProxy, dummyShutdownCtrl);

  // Report a failure, which should shutdown the node
  watchdogService.reportFailure(dataService.getLocalNodeId(),
              appName);

  // Node should not be alive since we reported a failure
  try {
      assertFalse(watchdogService.isLocalNodeAliveNonTransactional());
  } catch (Exception e) {
      fail("Not expecting an Exception: " + e.getLocalizedMessage());
  }
           
  // The shutdown controller should be incremented as a result of the
  // failure being reported
  assertEquals(1, dummyShutdownCtrl.getShutdownCount());
  watchdogService.shutdown();
  dataService.shutdown();
    }
View Full Code Here

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

  throws Exception
    {
  Properties props = SgsTestNode.getDefaultProperties(
      "TestWatchdogServiceImpl", serverNode, null);
  DataService data = createDataService(props);
  WatchdogServiceImpl watchdog =
      new WatchdogServiceImpl(props, systemRegistry, txnProxy,
            dummyShutdownCtrl);
  watchdog.addRecoveryListener(listener);
  watchdog.ready();
  System.err.println("Created node (" + data.getLocalNodeId() + ")");
  return new WatchdogAndData(watchdog, data);
    }
View Full Code Here

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

    /* -- Test constructor -- */

    @Test public void testConstructor() throws Exception {
  DataService dataService = null;
        WatchdogServiceImpl watchdog = null;
        try {
      dataService = createDataService(serviceProps);
            watchdog = new WatchdogServiceImpl(
    serviceProps, systemRegistry, txnProxy, dummyShutdownCtrl)
        } finally {
      if (dataService != null) dataService.shutdown();
            if (watchdog != null) watchdog.shutdown();
        }
    }
View Full Code Here

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

        }
    }

    @Test(expected = NullPointerException.class)
    public void testConstructorNullProperties() throws Exception {
        WatchdogServiceImpl watchdog = null;
  try {
      watchdog = new WatchdogServiceImpl(null, systemRegistry, txnProxy,
                 dummyShutdownCtrl);
  } finally {
            if (watchdog != null) watchdog.shutdown();
        }
    }
View Full Code Here

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

        }
    }

    @Test(expected = NullPointerException.class)
    public void testConstructorNullRegistry() throws Exception {
        WatchdogServiceImpl watchdog = null;
  try {
      watchdog = new WatchdogServiceImpl(serviceProps, null, txnProxy,
                 dummyShutdownCtrl);
  } finally {
            if (watchdog != null) watchdog.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.