Search in sources :

Example 1 with MBeanFactory

use of org.apache.catalina.mbeans.MBeanFactory in project tomcat70 by apache.

the class StandardServer method initInternal.

/**
 * Invoke a pre-startup initialization. This is used to allow connectors
 * to bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();
    // Register global String cache
    // Note although the cache is global, if there are multiple Servers
    // present in the JVM (may happen when embedding) then the same cache
    // will be registered under multiple names
    onameStringCache = register(new StringCache(), "type=StringCache");
    // Register the MBeanFactory
    MBeanFactory factory = new MBeanFactory();
    factory.setContainer(this);
    onameMBeanFactory = register(factory, "type=MBeanFactory");
    // Register the naming resources
    globalNamingResources.init();
    // class loaders
    if (getCatalina() != null) {
        ClassLoader cl = getCatalina().getParentClassLoader();
        // This will add the shared (if present) and common class loaders
        while (cl != null && cl != ClassLoader.getSystemClassLoader()) {
            if (cl instanceof URLClassLoader) {
                URL[] urls = ((URLClassLoader) cl).getURLs();
                for (URL url : urls) {
                    if (url.getProtocol().equals("file")) {
                        try {
                            File f = new File(url.toURI());
                            if (f.isFile() && f.getName().endsWith(".jar")) {
                                ExtensionValidator.addSystemResource(f);
                            }
                        } catch (URISyntaxException e) {
                        // Ignore
                        } catch (IOException e) {
                        // Ignore
                        }
                    }
                }
            }
            cl = cl.getParent();
        }
    }
    // Initialize our defined Services
    for (int i = 0; i < services.length; i++) {
        services[i].init();
    }
}
Also used : StringCache(org.apache.tomcat.util.buf.StringCache) URLClassLoader(java.net.URLClassLoader) URLClassLoader(java.net.URLClassLoader) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) MBeanFactory(org.apache.catalina.mbeans.MBeanFactory) File(java.io.File) URL(java.net.URL)

Example 2 with MBeanFactory

use of org.apache.catalina.mbeans.MBeanFactory in project tomcat by apache.

the class StandardServer method initInternal.

/**
 * Invoke a pre-startup initialization. This is used to allow connectors
 * to bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();
    // Initialize utility executor
    reconfigureUtilityExecutor(getUtilityThreadsInternal(utilityThreads));
    register(utilityExecutor, "type=UtilityExecutor");
    // Register global String cache
    // Note although the cache is global, if there are multiple Servers
    // present in the JVM (may happen when embedding) then the same cache
    // will be registered under multiple names
    onameStringCache = register(new StringCache(), "type=StringCache");
    // Register the MBeanFactory
    MBeanFactory factory = new MBeanFactory();
    factory.setContainer(this);
    onameMBeanFactory = register(factory, "type=MBeanFactory");
    // Register the naming resources
    globalNamingResources.init();
    // Initialize our defined Services
    for (Service service : services) {
        service.init();
    }
}
Also used : StringCache(org.apache.tomcat.util.buf.StringCache) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) Service(org.apache.catalina.Service) MBeanFactory(org.apache.catalina.mbeans.MBeanFactory)

Aggregations

MBeanFactory (org.apache.catalina.mbeans.MBeanFactory)2 StringCache (org.apache.tomcat.util.buf.StringCache)2 File (java.io.File)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 Service (org.apache.catalina.Service)1