Search in sources :

Example 1 with LoggerManager

use of com.sun.messaging.jmq.jmsserver.util.LoggerManager in project openmq by eclipse-ee4j.

the class CommGlobals method getConfig.

// ------------------------------------------------------------------------
// -- static methods for the singleton pattern --
// ------------------------------------------------------------------------
/**
 * method to return the singleton config class
 */
public static BrokerConfig getConfig() {
    if (config == null) {
        synchronized (lock) {
            if (config == null) {
                try {
                    config = new BrokerConfig(configName, parameters, clearProps, saveProps);
                } catch (BrokerException ex) {
                    getLogger().logStack(Logger.ERROR, "Internal Error: Unable to load broker, configuration properties are not available. Exiting", ex.getCause());
                    getCommBroker().exit(-1, "Internal Error: Unable to load broker," + " configuration properties are not available. Exiting", BrokerEvent.Type.FATAL_ERROR);
                }
                // now handle parameters
                if (parameters != null) {
                    // set any non-jmq properties as system properties
                    Enumeration en = parameters.propertyNames();
                    Properties sysprops = System.getProperties();
                    while (en.hasMoreElements()) {
                        String name = (String) en.nextElement();
                        if (!name.startsWith(IMQ + ".")) {
                            sysprops.put(name, parameters.getProperty(name));
                        }
                    }
                }
                // First thing we do after reading in configuration
                // is to initialize the Logger
                Logger l = getLogger();
                l.configure(config, IMQ, (getCommBroker() != null && getCommBroker().isInProcessBroker()), isJMSRAManagedSpecified(), (isNucleusManagedBroker() ? habitat : null));
                // LoggerManager will register as a config listener
                // to handle dynamic updates to logger properties
                new LoggerManager(logger, config);
            // l.open();
            }
        }
    }
    return config;
}
Also used : BrokerConfig(com.sun.messaging.jmq.jmsserver.config.BrokerConfig) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) Enumeration(java.util.Enumeration) LoggerManager(com.sun.messaging.jmq.jmsserver.util.LoggerManager) Properties(java.util.Properties) Logger(com.sun.messaging.jmq.util.log.Logger)

Aggregations

BrokerConfig (com.sun.messaging.jmq.jmsserver.config.BrokerConfig)1 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)1 LoggerManager (com.sun.messaging.jmq.jmsserver.util.LoggerManager)1 Logger (com.sun.messaging.jmq.util.log.Logger)1 Enumeration (java.util.Enumeration)1 Properties (java.util.Properties)1