Java 类net.floodlightcontroller.core.IShutdownListener 实例源码

项目:fresco_floodlight    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:fresco_floodlight    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:iTAP-controller    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:iTAP-controller    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:SDN-Multicast    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:SDN-Multicast    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:arscheduler    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:arscheduler    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:floodlight1.2-delay    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:floodlight1.2-delay    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:floodlight-hardware    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:floodlight-hardware    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:ACAMPController    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:ACAMPController    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:fast-failover-demo    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:fast-failover-demo    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:floodlightLB    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:floodlightLB    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:DSC    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:DSC    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:floodlight    文件:ShutdownServiceImpl.java   
@Override
public void registerShutdownListener(@Nonnull IShutdownListener listener) {
    if (listener == null) {
        throw new NullPointerException("listener must not be null");
    }
    shutdownListeners.add(listener);
}
项目:floodlight    文件:DebugEventTest.java   
@Override
@Before
public void setUp() throws Exception {
    debugEvent = new DebugEventService();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    IShutdownService shutdownService =
            EasyMock.createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    EasyMock.expectLastCall().once();
    EasyMock.replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    debugEvent.startUp(fmc);
    EasyMock.verify(shutdownService);
}
项目:fresco_floodlight    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:fresco_floodlight    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}
项目:iTAP-controller    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:iTAP-controller    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}
项目:SDN-Multicast    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:SDN-Multicast    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}
项目:arscheduler    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:arscheduler    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}
项目:floodlight1.2-delay    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:floodlight1.2-delay    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}
项目:floodlight-hardware    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:floodlight-hardware    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}
项目:ACAMPController    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:ACAMPController    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}
项目:fast-failover-demo    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:fast-failover-demo    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}
项目:floodlightLB    文件:ShutdownServiceImpl.java   
@SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
@Override
public void terminate(@Nullable final String reason, final int exitCode) {
    final String paddedReason;
    if (reason == null) {
        paddedReason = "";
    } else {
        paddedReason = " due to " + reason;
    }
    // A safety valve to make sure we really do indeed terminate floodlight
    // We are using a Thread rather than a task to make sure nothing can
    // cancel the shutdown (e.g., if an ExecutorService was already
    // shutdown
    Thread shutdownForHungListeners =  new Thread(new Runnable() {
        // Suppress findbugs warning that we call system.exit
        @SuppressFBWarnings(value="DM_EXIT", justification="exit by design")
        @Override
        public void run() {
            try {
                Thread.sleep(MAX_SHUTDOWN_WAIT_MS);
            } catch (InterruptedException e) {
                // do nothing, we are about to exit anyways
            }
            logger.error("**************************************************");
            logger.error("* Floodlight is terminating {}", paddedReason);
            logger.error("* ShutdownListeners failed to complete in time");
            logger.error("**************************************************");
            System.exit(exitCode);
        }
    }, "ShutdownSafetyValve");
    shutdownForHungListeners.start();
    logger.info("Floodlight about to terminate. Calling shutdown listeners");
    for (IShutdownListener listener: shutdownListeners) {
        listener.floodlightIsShuttingDown();
    }
    if (exitCode == 0) {
        logger.info("**************************************************");
        logger.info("* Floodlight is terminating normally{}", paddedReason);
        logger.info("**************************************************");
    } else {
        logger.error("**************************************************");
        logger.error("* Floodlight is terminating abnormally{}", paddedReason);
        logger.error("**************************************************");
    }
    // Game Over.
    System.exit(exitCode);
}
项目:floodlightLB    文件:OFSwitchManagerTest.java   
public void doSetUp(HARole role) throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();

    FloodlightProvider cm = new FloodlightProvider();
    fmc.addConfigParam(cm, "role", role.toString());
    controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
    fmc.addService(IFloodlightProviderService.class, controller);

    MemoryStorageSource memstorage = new MemoryStorageSource();
    fmc.addService(IStorageSourceService.class, memstorage);

    RestApiServer restApi = new RestApiServer();
    fmc.addService(IRestApiService.class, restApi);

    ThreadPool threadPool = new ThreadPool();
    fmc.addService(IThreadPoolService.class, threadPool);

    // TODO: should mock IDebugCounterService and make sure
    // the expected counters are updated.
    MockDebugCounterService debugCounterService = new MockDebugCounterService();
    fmc.addService(IDebugCounterService.class, debugCounterService);

    DebugEventService debugEventService = new DebugEventService();
    fmc.addService(IDebugEventService.class, debugEventService);

    switchManager = new OFSwitchManager();
    fmc.addService(IOFSwitchService.class, switchManager);

    MockSyncService syncService = new MockSyncService();
    fmc.addService(ISyncService.class, syncService);

    IShutdownService shutdownService = createMock(IShutdownService.class);
    shutdownService.registerShutdownListener(anyObject(IShutdownListener.class));
    expectLastCall().anyTimes();
    replay(shutdownService);
    fmc.addService(IShutdownService.class, shutdownService);
    verify(shutdownService);

    threadPool.init(fmc);
    syncService.init(fmc);
    switchManager.init(fmc);
    debugCounterService.init(fmc);
    memstorage.init(fmc);
    debugEventService.init(fmc);
    restApi.init(fmc);
    cm.init(fmc);

    syncService.init(fmc);
    switchManager.startUpBase(fmc);
    debugCounterService.startUp(fmc);
    memstorage.startUp(fmc);
    debugEventService.startUp(fmc);
    threadPool.startUp(fmc);
    restApi.startUp(fmc);
    cm.startUp(fmc);
}