public void shutdown()

in src/main/java/com/revo/deployr/client/broker/engine/RBrokerEngine.java [449:510]


    public void shutdown() {

        taskBrokerIsActive.set(false);

        try {

            if (resourceTokenPool != null) {

                Object resourceToken = resourceTokenPool.peek();
                if (resourceToken instanceof RProject) {

                    PooledBrokerConfig pbcfg =
                            (PooledBrokerConfig) brokerConfig;
                    boolean releaseGridResources =
                            pbcfg.poolCreationOptions.releaseGridResources;
                    if (releaseGridResources) {
                        /*
                         * If PooledTaskBroker resource tokens
                         * and rUser available, perform a server-wide
                         * flush of projects on the grid.
                         */
                        rUser.releaseProjects();
                    } else {
                        /*
                         * If PooledTaskBroker resource tokens
                         * and rUser not available, perform
                         * project-by-project flush on the grid.
                         */
                        for (Object resToken : resourceTokenPool) {
                            if (resToken instanceof RProject) {
                                RProject projectToken =
                                        (RProject) resourceToken;
                                try {
                                    projectToken.close();
                                } catch (Exception pex) {
                                }
                            }
                        }
                    }
                }

                resourceTokenPool = null;
            }
        } catch (Exception cex) {
        }

        if (rClient != null) {
            try {
                rClient.release();
            } catch (Exception rex) {
            }
        }

        try {
            brokerEngineExecutor.shutdownNow();
        } catch (Exception bex) {
        }
        try {
            taskWorkerExecutor.shutdownNow();
        } catch (Exception tex) {
        }
    }