Search in sources :

Example 1 with ThreadPool

use of com.sun.corba.ee.spi.threadpool.ThreadPool in project Payara by payara.

the class PEORBConfigurator method configure.

public void configure(DataCollector dc, ORB orb) {
    try {
        // end temp fix for bug 6320008
        if (threadpoolMgr != null) {
            // This will be the case for the Server Side ORB created
            // For client side threadpoolMgr will be null, so we will
            // never come here
            orb.setThreadPoolManager(threadpoolMgr);
        }
        // Do the stats for the threadpool
        ThreadPoolManager tpool = orb.getThreadPoolManager();
        // ORB creates its own threadpool if threadpoolMgr was null above
        ThreadPool thpool = tpool.getDefaultThreadPool();
        String ThreadPoolName = thpool.getName();
        ThreadPoolStats tpStats = new ThreadPoolStatsImpl(thpool.getWorkQueue(0).getThreadPool());
        StatsProviderManager.register("orb", PluginPoint.SERVER, "thread-pool/orb/threadpool/" + ThreadPoolName, tpStats);
        configureCopiers(orb);
        configureCallflowInvocationInterceptor(orb);
        // In the server-case, iiop acceptors need to be set up after the
        // initial part of the orb creation but before any
        // portable interceptor initialization
        IIOPUtils iiopUtils = IIOPUtils.getInstance();
        if (iiopUtils.getProcessType().isServer()) {
            List<IiopListener> iiop_listener_list = IIOPUtils.getInstance().getIiopService().getIiopListener();
            IiopListener[] iiopListenerBeans = iiop_listener_list.toArray(new IiopListener[iiop_listener_list.size()]);
            this.createORBListeners(iiopUtils, iiopListenerBeans, orb);
        }
        if (orb.getORBData().environmentIsGFServer()) {
            // Start the transient name service, which publishes NameService
            // in the ORB's local resolver.
            new TransientNameService(orb);
        }
        // Publish the ORB reference back to GlassFishORBHelper, so that
        // subsequent calls from interceptor ORBInitializers can call
        // GlassFishORBHelper.getORB() without problems.  This is
        // especially important for code running in the service initializer
        // thread.
        getHelper().setORB(orb);
    } catch (NoSuchWorkQueueException ex) {
        Logger.getLogger(PEORBConfigurator.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) NoSuchWorkQueueException(com.sun.corba.ee.spi.threadpool.NoSuchWorkQueueException) ThreadPoolStats(org.glassfish.enterprise.iiop.util.ThreadPoolStats) ThreadPoolStatsImpl(org.glassfish.enterprise.iiop.util.ThreadPoolStatsImpl) ThreadPool(com.sun.corba.ee.spi.threadpool.ThreadPool) TransientNameService(com.sun.corba.ee.impl.naming.cosnaming.TransientNameService) ThreadPoolManager(com.sun.corba.ee.spi.threadpool.ThreadPoolManager) S1ASThreadPoolManager(org.glassfish.enterprise.iiop.util.S1ASThreadPoolManager) IIOPUtils(org.glassfish.enterprise.iiop.util.IIOPUtils)

Example 2 with ThreadPool

use of com.sun.corba.ee.spi.threadpool.ThreadPool in project Payara by payara.

the class S1ASThreadPoolManager method createThreadPools.

private static void createThreadPools(org.glassfish.grizzly.config.dom.ThreadPool threadpoolBean, int index) {
    String threadpoolId = null;
    // , numberOfQueuesValue;
    String minThreadsValue, maxThreadsValue, timeoutValue;
    int minThreads = DEFAULT_MIN_THREAD_COUNT;
    int maxThreads = DEFAULT_MAX_THREAD_COUNT;
    int idleTimeoutInSeconds = 120000;
    try {
        threadpoolId = threadpoolBean.getName();
    } catch (NullPointerException npe) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, "ThreadPoolBean may be null ", npe);
        }
    }
    try {
        minThreadsValue = threadpoolBean.getMinThreadPoolSize();
        minThreads = Integer.parseInt(minThreadsValue);
    } catch (NullPointerException npe) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, "ThreadPoolBean may be null ", npe);
            _logger.log(Level.WARNING, "Using default value for steady-threadpool-size = " + minThreads);
        }
    } catch (NumberFormatException nfe) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, "enterprise_util.excep_orbmgr_numfmt", nfe);
            _logger.log(Level.WARNING, "Using default value for min-threadpool-size = " + minThreads);
        }
    }
    try {
        maxThreadsValue = threadpoolBean.getMaxThreadPoolSize();
        maxThreads = Integer.parseInt(maxThreadsValue);
    } catch (NullPointerException npe) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, "ThreadPoolBean may be null ", npe);
            _logger.log(Level.WARNING, "Using default value for max-threadpool-size = " + maxThreads);
        }
    } catch (NumberFormatException nfe) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, "enterprise_util.excep_orbmgr_numfmt", nfe);
            _logger.log(Level.WARNING, "Using default value for max-threadpool-size = " + maxThreads);
        }
    }
    try {
        timeoutValue = threadpoolBean.getIdleThreadTimeoutSeconds();
        idleTimeoutInSeconds = Integer.parseInt(timeoutValue);
    } catch (NullPointerException npe) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, "ThreadPoolBean may be null ", npe);
            _logger.log(Level.WARNING, "Using default value for idle-thread-timeout-in-seconds = " + idleTimeoutInSeconds);
        }
    } catch (NumberFormatException nfe) {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, "enterprise_util.excep_orbmgr_numfmt", nfe);
            _logger.log(Level.WARNING, "Using default value for idle-thread-timeout-in-seconds = " + idleTimeoutInSeconds);
        }
    }
    // Currently this value is not used but when multi-queue threadpools are
    // implemented this could be used to decide which one to instantiate and
    // number of queues in the multi-queue threadpool
    /*
        try {
            numberOfQueuesValue = threadpoolBean.getNumWorkQueues();
            numberOfQueues = Integer.parseInt(numberOfQueuesValue);
        } catch (NullPointerException npe) {
            if (_logger.isLoggable(Level.WARNING)) {
                _logger.log(Level.WARNING, "ThreadPoolBean may be null ", npe);
                _logger.log(Level.WARNING,
                        "Using default value for num-work-queues = " +
                                numberOfQueues);
            }
        } catch (NumberFormatException nfe) {
            if (_logger.isLoggable(Level.WARNING)) {
                _logger.log(Level.WARNING, "enterprise_util.excep_orbmgr_numfmt", nfe);
                _logger.log(Level.WARNING,
                        "Using default value for num-work-queues = " +
                                numberOfQueues);
            }
        }
*/
    // Mutiplied the idleTimeoutInSeconds by 1000 to convert to milliseconds
    ThreadPoolFactory threadPoolFactory = new ThreadPoolFactory();
    ThreadPool threadpool = threadPoolFactory.create(minThreads, maxThreads, idleTimeoutInSeconds * 1000L, threadpoolId, _iiopUtils.getCommonClassLoader());
    // Add the threadpool instance to the threadpoolList
    threadpoolList.add(threadpool);
    // Associate the threadpoolId to the index passed
    idToIndexTable.put(threadpoolId, index);
    // Associate the threadpoolId to the index passed
    indexToIdTable.put(index, threadpoolId);
}
Also used : ThreadPool(com.sun.corba.ee.spi.threadpool.ThreadPool) ThreadPoolFactory(com.sun.corba.ee.spi.threadpool.ThreadPoolFactory)

Aggregations

ThreadPool (com.sun.corba.ee.spi.threadpool.ThreadPool)2 TransientNameService (com.sun.corba.ee.impl.naming.cosnaming.TransientNameService)1 NoSuchWorkQueueException (com.sun.corba.ee.spi.threadpool.NoSuchWorkQueueException)1 ThreadPoolFactory (com.sun.corba.ee.spi.threadpool.ThreadPoolFactory)1 ThreadPoolManager (com.sun.corba.ee.spi.threadpool.ThreadPoolManager)1 IIOPUtils (org.glassfish.enterprise.iiop.util.IIOPUtils)1 S1ASThreadPoolManager (org.glassfish.enterprise.iiop.util.S1ASThreadPoolManager)1 ThreadPoolStats (org.glassfish.enterprise.iiop.util.ThreadPoolStats)1 ThreadPoolStatsImpl (org.glassfish.enterprise.iiop.util.ThreadPoolStatsImpl)1 IiopListener (org.glassfish.orb.admin.config.IiopListener)1