Example usage for org.apache.commons.pool.impl GenericObjectPool getSoftMinEvictableIdleTimeMillis

List of usage examples for org.apache.commons.pool.impl GenericObjectPool getSoftMinEvictableIdleTimeMillis

Introduction

In this page you can find the example usage for org.apache.commons.pool.impl GenericObjectPool getSoftMinEvictableIdleTimeMillis.

Prototype

public synchronized long getSoftMinEvictableIdleTimeMillis() 

Source Link

Document

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 (if any), with the extra condition that at least "minIdle" amount of object remain in the pool.

Usage

From source file:edu.illinois.enforcemop.examples.apache.pool.TestGenericObjectPool.java

public void testSettersAndGetters() throws Exception {
    GenericObjectPool pool = new GenericObjectPool();
    {/*from   w w w  .j  a  va2  s  . c o  m*/
        pool.setFactory(new SimpleFactory());
    }
    {
        pool.setMaxActive(123);
        assertEquals(123, pool.getMaxActive());
    }
    {
        pool.setMaxIdle(12);
        assertEquals(12, pool.getMaxIdle());
    }
    {
        pool.setMaxWait(1234L);
        assertEquals(1234L, pool.getMaxWait());
    }
    {
        pool.setMinEvictableIdleTimeMillis(12345L);
        assertEquals(12345L, pool.getMinEvictableIdleTimeMillis());
    }
    {
        pool.setNumTestsPerEvictionRun(11);
        assertEquals(11, pool.getNumTestsPerEvictionRun());
    }
    {
        pool.setTestOnBorrow(true);
        assertTrue(pool.getTestOnBorrow());
        pool.setTestOnBorrow(false);
        assertTrue(!pool.getTestOnBorrow());
    }
    {
        pool.setTestOnReturn(true);
        assertTrue(pool.getTestOnReturn());
        pool.setTestOnReturn(false);
        assertTrue(!pool.getTestOnReturn());
    }
    {
        pool.setTestWhileIdle(true);
        assertTrue(pool.getTestWhileIdle());
        pool.setTestWhileIdle(false);
        assertTrue(!pool.getTestWhileIdle());
    }
    {
        pool.setTimeBetweenEvictionRunsMillis(11235L);
        assertEquals(11235L, pool.getTimeBetweenEvictionRunsMillis());
    }
    {
        pool.setSoftMinEvictableIdleTimeMillis(12135L);
        assertEquals(12135L, pool.getSoftMinEvictableIdleTimeMillis());
    }
    {
        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_BLOCK, pool.getWhenExhaustedAction());
        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_FAIL, pool.getWhenExhaustedAction());
        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
    }
}

From source file:sce.Main.java

public String getConnectionPoolInfo() {
    JSONObject results_obj = new JSONObject();
    GenericObjectPool pool = connectionPool.getConnectionPool();

    results_obj.put("Lifo", pool.getLifo());
    results_obj.put("MaxActive", pool.getMaxActive());
    results_obj.put("MaxIdle", pool.getMaxIdle());
    results_obj.put("MaxWait", pool.getMaxWait());
    results_obj.put("MinEvictableIdleTimeMillis", pool.getMinEvictableIdleTimeMillis());
    results_obj.put("MinIdle", pool.getMinIdle());
    results_obj.put("NumActive", pool.getNumActive());
    results_obj.put("NumIdle", pool.getNumIdle());
    results_obj.put("NumTestsPerEvictionRun", pool.getNumTestsPerEvictionRun());
    results_obj.put("SoftMinEvictableIdleTimeMillis", pool.getSoftMinEvictableIdleTimeMillis());
    results_obj.put("TestOnBorrow", pool.getTestOnBorrow());
    results_obj.put("TestOnReturn", pool.getTestOnReturn());
    results_obj.put("TestWhileIdle", pool.getTestWhileIdle());
    results_obj.put("TimeBetweenEvictionRunsMillis", pool.getTimeBetweenEvictionRunsMillis());
    results_obj.put("WhenExhaustedAction", pool.getWhenExhaustedAction());

    return results_obj.toJSONString();
}