Example usage for org.apache.commons.pool PoolUtils synchronizedPool

List of usage examples for org.apache.commons.pool PoolUtils synchronizedPool

Introduction

In this page you can find the example usage for org.apache.commons.pool PoolUtils synchronizedPool.

Prototype

public static KeyedObjectPool synchronizedPool(final KeyedObjectPool keyedPool) 

Source Link

Document

Returns a synchronized (thread-safe) KeyedObjectPool backed by the specified KeyedObjectPool.

Usage

From source file:org.dspace.event.EventManager.java

private static void initPool() {

    if (dispatcherPool == null) {

        // TODO EVENT Some of these pool configuration
        // parameters can live in dspace.cfg or a
        // separate configuration file

        // TODO EVENT Eviction parameters should be set

        poolConfig = new GenericKeyedObjectPool.Config();
        poolConfig.maxActive = 100;// w w  w  .  j ava2  s  .  c om
        poolConfig.maxIdle = 5;
        poolConfig.maxTotal = 100;

        try {
            dispatcherFactory = new DispatcherPoolFactory();
            dispatcherPool = PoolUtils
                    .synchronizedPool(new GenericKeyedObjectPool(dispatcherFactory, poolConfig));

            enumerateConsumers();

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}