Package com.xmultra.manager

Examples of com.xmultra.manager.Manager


        // Request that each manager(s) stop.
        for (int i = 0; i < managerArray.length; i++) {

            // Get this manager.
            Manager manager = (Manager)managerArray[i];

            // Remove this manager from the list of managers.
            // It will get added back in during manager.init().
            callbackRegistry.removeFromManagerList(manager, this);

            // Clear out the LogRegistry (which is used to check for duplicate
            // log files).
            LogUtils.clearManagersFromLogRegistry(manager);

            // Request for the manager to stop running.
            manager.stopRunningRequest(false);
        }

        // Wait for the managers to stop and restart.
        for (int i = 0; i < managerArray.length; i++) {

            // Get this manager.
            Manager manager = (Manager)managerArray[i];

            // Get the node from the existing manager and wait for it to stop.
            Node mgrNode = manager.stopRunningWait();

            // Re-initialize that manager with its node. If no sucess, retry.
            try {
                if (!manager.init(mgrNode, Xmultra.getXmultraRootDir(),
                    manager.getStartingManagersSyncFlag())) {

                    // There is an error so throw exception.
                    throw new InvalidConfigFileFormatException();
                }
            }
            catch (InvalidConfigFileFormatException e) {
                msgEntry.setAppContext("reloadProcessorConfigFile()");
                msgEntry.setDocInfo(origConfigFile.toString());
                msgEntry.setMessageText("Error in new config file. " +
                        "Reverting to previous config file. " +
                        "Bad config file moved to 'old' location.");
                msgEntry.setError(e.getMessage());
                logger.logWarning(msgEntry);

                // Restore the original file.
                restoreOriginalConfigFile(oldFile, origConfigFile, newConfigFile);

                // Try to reload again.
                try {
                    // Remove this manager from the list of managers.
                    // It will get added back in during manager.init().
                    callbackRegistry.removeFromManagerList(manager, this);

                    // Re-initialize the manager with original cfg file.
                    // If no sucess, give up.
                    if (!manager.init(mgrNode, Xmultra.getXmultraRootDir(),
                        manager.getStartingManagersSyncFlag())) {

                        // There is an error so throw exception.
                        throw new InvalidConfigFileFormatException();
                    }
                }
                catch (InvalidConfigFileFormatException ie) {

                    // Couldn't even reload the old config file.
                    msgEntry.setAppContext("reloadProcessorConfigFile()");
                    msgEntry.setDocInfo(configFile.toString());
                    msgEntry.setMessageText("'" + manager.getManagerDescription() +
                            "' unable to reload old config file!\nManager NOT reloaded.");
                    msgEntry.setError(e.getMessage());
                    logger.logWarning(msgEntry);
                    return null;
                }
            }

            // Create & launch the thread.
            Thread t = new Thread(manager, "Manager Thread");
            t.start();

            // Log message.
            msgEntry.setAppContext("reloadProcessorConfigFile()");
            msgEntry.setDocInfo(configFile.toString());
            msgEntry.setMessageText("'" + manager.getManagerDescription() +
                    "' Manager reloaded.");
            logger.logProcess(msgEntry);
        }

        // Delete new file now that reload is complete.
View Full Code Here


            return null;
        }

        // Get the list of Managers.
        Object[] managers = callbackRegistry.getManagerList(this);
        Manager manager = null;
        Manager configManager = null;

        // Request all Managers to stop.
        for (int i = 0; i < managers.length; i++) {

            // Get the Manager.
            manager = (Manager)managers[i];

            // Don't request the ConfigProcessor's Manager to stop yet.
            if(!manager.isSameProcessor(this)) {

                // Request the manager to shutdown.
                manager.stopRunningRequest(false);

                // Log message for shutdown request.
                msgEntry.setAppContext("shutdownOrReloadXmultraConfigFile()");
                msgEntry.setMessageText("'" + manager.getManagerDescription() +
                        "' requested to shutdown.");
                msgEntry.setSendToSystemLog(false);
                logger.logProcess(msgEntry);
            }
        }

        // Now wait for each Manager to stop.
        for (int i = 0; i < managers.length; i++) {

            // Get the Manager.
            manager = (Manager)managers[i];

            // Wait until the current manager has been shutdown.
            // Don't wait for the ConfigProcessor's Manager to stop.
            if(!manager.isSameProcessor(this)) {
                manager.stopRunningWait();

                // Log message after the manager/processor has stopped.
                msgEntry.setAppContext("shutdownOrReloadXmultraConfigFile()");
                msgEntry.setDocInfo(xmultraConfigFile.toString());
                msgEntry.setMessageText("'" + manager.getManagerDescription() +
                        "' Manager stopped.");
                msgEntry.setSendToSystemLog(false);
                logger.logProcess(msgEntry);
            }
            else {
                configManager = manager;
            }
        }

        // Now stop the manager for this ConfigProcessor but don't stop
        // this processor (it's got more work to do).
        configManager.stopRunningRequest(true);
        configManager.stopRunningWait();

        // Clear out the ManagerList in the CallbackRegistry.
        callbackRegistry.clearRegistry(this);

        // Clear out the LogRegistry (which is used to check for duplicate
View Full Code Here

            if (managerDescription == null) {
                managerDescription = "#" + i;
            }

            // Create an instance of the manager class.
            Manager manager = getManagerInstance(managerNodelist.item(i));

            try {
                // Start thread if init was successfull.
                if (manager != null &&
                    manager.init(managerNodelist.item(i), xmultraRootDir,
                                 startingManagersSyncFlag)) {

                    // Create the thread, set priority and launch.
                    Thread t = new Thread(manager, managerDescription);
                    t.start();
View Full Code Here

     * @param node  The Node which has the name of the Manager.
     *
     * @return An instantiated Manager.
     */
    private Manager getManagerInstance(Node node) {
        Manager manager = null;
        String managerClassName = "";
        try {

            // Get the Manager's class name.
            managerClassName = xmlParseUtils.getAttributeValueFromNode(node,
View Full Code Here

TOP

Related Classes of com.xmultra.manager.Manager

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.