Search in sources :

Example 1 with ThreadPoolConfig

use of org.forgerock.openam.radius.server.config.ThreadPoolConfig in project OpenAM by OpenRock.

the class RequestListenerFactory method getRadiusRequestListener.

/**
     * Factory method to obtain a new RadiusRequestListener.
     *
     * @param serviceConfig - the configuration of the RADIUS service.
     * @return a <code>RadiusRquestListener</code>
     * @throws RadiusLifecycleException - if a RquestListener can not be created.
     */
public RadiusRequestListener getRadiusRequestListener(RadiusServiceConfig serviceConfig) throws RadiusLifecycleException {
    final ThreadPoolConfig poolConfig = serviceConfig.getThreadPoolConfig();
    final int coreSize = poolConfig.getCoreThreads();
    final int maxSize = poolConfig.getMaxThreads();
    final int idleTimeout = poolConfig.getKeepAliveSeconds();
    final ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(poolConfig.getQueueSize());
    final ExecutorService executorService = executorServiceFactory.createThreadPool(coreSize, maxSize, idleTimeout, TimeUnit.SECONDS, queue);
    return new RadiusRequestListener(serviceConfig, executorService, eventBus, accessRequestHandlerFactory);
}
Also used : ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) ExecutorService(java.util.concurrent.ExecutorService) ThreadPoolConfig(org.forgerock.openam.radius.server.config.ThreadPoolConfig)

Aggregations

ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 ExecutorService (java.util.concurrent.ExecutorService)1 ThreadPoolConfig (org.forgerock.openam.radius.server.config.ThreadPoolConfig)1