Package net.floodlightcontroller.core.util

Examples of net.floodlightcontroller.core.util.SingletonTask


    @Override
    public void startUp(FloodlightModuleContext context) {
        // thread to do flow reconcile
        ScheduledExecutorService ses = threadPool.getScheduledExecutor();
        flowReconcileTask = new SingletonTask(ses, new Runnable() {
            @Override
            public void run() {
                try {
                    if (doReconcile()) {
                        flowReconcileTask.reschedule(
View Full Code Here


        clearCurrentTopology();
        // Initialize role to floodlight provider role.
        this.role = floodlightProvider.getRole();

        ScheduledExecutorService ses = threadPool.getScheduledExecutor();
        newInstanceTask = new SingletonTask(ses, new UpdateTopologyWorker());

        if (role != Role.SLAVE)
            newInstanceTask.reschedule(TOPOLOGY_COMPUTE_INTERVAL_MS,
                                   TimeUnit.MILLISECONDS);
View Full Code Here

        bootstrap.setPipelineFactory(pipelineFactory);
        clientBootstrap = bootstrap;

        ScheduledExecutorService ses =
                syncManager.getThreadPool().getScheduledExecutor();
        reconnectTask = new SingletonTask(ses, new ConnectTask());
        reconnectTask.reschedule(0, TimeUnit.SECONDS);
    }
View Full Code Here

                cleanupEntities();
                entityCleanupTask.reschedule(ENTITY_CLEANUP_INTERVAL,
                                             TimeUnit.SECONDS);
            }
        };
        entityCleanupTask = new SingletonTask(ses, ecr);
        entityCleanupTask.reschedule(ENTITY_CLEANUP_INTERVAL,
                                     TimeUnit.SECONDS);

        Runnable consolidateStoreRunner = new Runnable() {
            @Override
            public void run() {
                deviceSyncManager.consolidateStore();
                storeConsolidateTask.reschedule(syncStoreConsolidateIntervalMs,
                                                TimeUnit.MILLISECONDS);
            }
        };
        storeConsolidateTask = new SingletonTask(ses, consolidateStoreRunner);
        if (isMaster)
            storeConsolidateTask.reschedule(syncStoreConsolidateIntervalMs,
                                            TimeUnit.MILLISECONDS);

View Full Code Here

    public void startUp(FloodlightModuleContext context)
            throws FloodlightModuleException {

        rpcService = new RPCService(this, debugCounter);

        cleanupTask = new SingletonTask(threadPool.getScheduledExecutor(),
                                        new CleanupTask());
        cleanupTask.reschedule(CLEANUP_INTERVAL +
                               random.nextInt(30), TimeUnit.SECONDS);

        antientropyTask = new SingletonTask(threadPool.getScheduledExecutor(),
                                       new AntientropyTask());
        antientropyTask.reschedule(ANTIENTROPY_INTERVAL +
                                   random.nextInt(30), TimeUnit.SECONDS);

        final ThreadGroup tg = new ThreadGroup("Hint Workers");
        tg.setMaxPriority(Thread.NORM_PRIORITY - 2);
        ThreadFactory f = new ThreadFactory() {
            AtomicInteger id = new AtomicInteger();

            @Override
            public Thread newThread(Runnable runnable) {
                return new Thread(tg, runnable,
                                  "HintWorker-" + id.getAndIncrement());
            }
        };
        hintThreadPool = Executors.newCachedThreadPool(f);
        for (int i = 0; i < SYNC_WORKER_POOL; i++) {
            hintThreadPool.execute(new HintWorker());
        }

        doUpdateConfiguration();
        rpcService.run();

        updateConfigTask =
                new SingletonTask(threadPool.getScheduledExecutor(),
                                  new UpdateConfigTask());
        updateConfigTask.reschedule(CONFIG_RESCAN_INTERVAL, TimeUnit.SECONDS);
    }
View Full Code Here

    }

    @Override
    public ClusterConfig getConfig() throws SyncException {
        if (bootstrapTask == null)
            bootstrapTask = new SingletonTask(threadPool.getScheduledExecutor(),
                                              new BootstrapTask());

        keyStorePath = config.get("keyStorePath");
        keyStorePassword = config.get("keyStorePassword");
        try {
View Full Code Here

        }

        ScheduledExecutorService ses = threadPool.getScheduledExecutor();

        // To be started by the first switch connection
        discoveryTask = new SingletonTask(ses, new Runnable() {
            @Override
            public void run() {
                try {
                    discoverLinks();
                } catch (StorageException e) {
                    log.error("Storage exception in LLDP send timer; "
                              + "terminating process", e);
                    floodlightProvider.terminate();
                } catch (Exception e) {
                    log.error("Exception in LLDP send timer.", e);
                } finally {
                    if (!shuttingDown) {
                        // null role implies HA mode is not enabled.
                        if (role == null || role == Role.MASTER) {
                            log.trace("Rescheduling discovery task as role = {}",
                                      role);
                            discoveryTask.reschedule(DISCOVERY_TASK_INTERVAL,
                                                     TimeUnit.SECONDS);
                        } else {
                            log.trace("Stopped LLDP rescheduling due to role = {}.",
                                      role);
                        }
                    }
                }
            }
        });

        // null role implies HA mode is not enabled.
        if (role == null || role == Role.MASTER) {
            log.trace("Setup: Rescheduling discovery task. role = {}", role);
            discoveryTask.reschedule(DISCOVERY_TASK_INTERVAL,
                                     TimeUnit.SECONDS);
        } else {
            log.trace("Setup: Not scheduling LLDP as role = {}.", role);
        }

        // Setup the BDDP task. It is invoked whenever switch port tuples
        // are added to the quarantine list.
        bddpTask = new SingletonTask(ses, new QuarantineWorker());
        bddpTask.reschedule(BDDP_TASK_INTERVAL, TimeUnit.MILLISECONDS);

        updatesThread = new Thread(new Runnable() {
            @Override
            public void run() {
View Full Code Here

TOP

Related Classes of net.floodlightcontroller.core.util.SingletonTask

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.