Package com.sun.sgs.impl.service.watchdog

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


        appProps.setProperty(
                "com.sun.sgs.impl.service.watchdog.timesync.interval",
                "1000");
        addNodes(appProps, 1);

        WatchdogServerImpl watchdogServer = watchdogService.getServer();
        WatchdogService remoteWatchdogService =
                        additionalNodes[0].getWatchdogService();

        // watchdog server and service should initially be sync'd
        long serverTime = watchdogServer.currentAppTimeMillis();
        long serviceTime = remoteWatchdogService.currentAppTimeMillis();
        assertTrue(checkInRange(serverTime,
                                serviceTime,
                                Constants.MAX_CLOCK_GRANULARITY));

        // force watchdog service out of sync
        Field serviceTimeOffset = getField(WatchdogServiceImpl.class,
                                           "timeOffset");
        serviceTimeOffset.set(remoteWatchdogService, 0);
        serverTime = watchdogServer.currentAppTimeMillis();
        serviceTime = remoteWatchdogService.currentAppTimeMillis();
        assertFalse(checkInRange(serverTime,
                                 serviceTime,
                                 Constants.MAX_CLOCK_GRANULARITY));

        // wait for time sync interval and verify service syncs back with server
        Thread.sleep(1000 + Constants.MAX_CLOCK_GRANULARITY);
        serverTime = watchdogServer.currentAppTimeMillis();
        serviceTime = remoteWatchdogService.currentAppTimeMillis();
        assertTrue(checkInRange(serverTime,
                                serviceTime,
                                Constants.MAX_CLOCK_GRANULARITY));
    }
View Full Code Here


        appProps.setProperty(
                "com.sun.sgs.impl.service.watchdog.timesync.interval",
                "1000");
        addNodes(appProps, 1);

        WatchdogServerImpl watchdogServer = watchdogService.getServer();
        WatchdogService remoteWatchdogService =
                        additionalNodes[0].getWatchdogService();

        // watchdog server and service should initially be sync'd
        long serverTime = watchdogServer.currentAppTimeMillis();
        long serviceTime = remoteWatchdogService.currentAppTimeMillis();
        assertTrue(checkInRange(serverTime,
                                serviceTime,
                                Constants.MAX_CLOCK_GRANULARITY));

        // force watchdog service out of sync
        Field serviceTimeOffset = getField(WatchdogServiceImpl.class,
                                           "timeOffset");
        serviceTimeOffset.set(remoteWatchdogService, 0);
        serverTime = watchdogServer.currentAppTimeMillis();
        serviceTime = remoteWatchdogService.currentAppTimeMillis();
        assertFalse(checkInRange(serverTime,
                                 serviceTime,
                                 Constants.MAX_CLOCK_GRANULARITY));

        // wait for time sync interval and verify service syncs back with server
        Thread.sleep(1000 + Constants.MAX_CLOCK_GRANULARITY);
        serverTime = watchdogServer.currentAppTimeMillis();
        serviceTime = remoteWatchdogService.currentAppTimeMillis();
        assertTrue(checkInRange(serverTime,
                                serviceTime,
                                Constants.MAX_CLOCK_GRANULARITY));
    }
View Full Code Here

TOP

Related Classes of com.sun.sgs.impl.service.watchdog.WatchdogServerImpl

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.