Example usage for org.apache.commons.pool2.impl GenericObjectPoolConfig setJmxEnabled

List of usage examples for org.apache.commons.pool2.impl GenericObjectPoolConfig setJmxEnabled

Introduction

In this page you can find the example usage for org.apache.commons.pool2.impl GenericObjectPoolConfig setJmxEnabled.

Prototype

public void setJmxEnabled(boolean jmxEnabled) 

Source Link

Document

Sets the value of the flag that determines if JMX will be enabled for pools created with this configuration instance.

Usage

From source file:stroom.statistics.server.sql.SQLStatisticEventStore.java

private GenericObjectPoolConfig getObjectPoolConfig() {
    final GenericObjectPoolConfig config = new GenericObjectPoolConfig();
    // Max number of idle items .... same as our pool size
    config.setMaxIdle(poolSize);//from w  w  w.j  a va  2s  . c om
    // Pool size
    config.setMaxTotal(poolSize);
    // Returns the minimum amount of time an object may sit idle in the pool
    // before it is eligible for eviction by the idle object evictor
    // Here if it is idle for 10 min's it will simply return It will also
    // return by validateObject if it is simple more than 10min old
    config.setMinEvictableIdleTimeMillis(poolAgeMsThreshold);
    // Check for idle objects never .... we will do this with task sytstem
    config.setTimeBetweenEvictionRunsMillis(0);
    // Must cause other threads to block to wait for a object
    config.setBlockWhenExhausted(true);
    config.setJmxEnabled(false);
    // Check item on just before returning to pool
    config.setTestOnReturn(true);

    return config;
}