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

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

Introduction

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

Prototype

public synchronized long getTimeBetweenEvictionRunsMillis() 

Source Link

Document

Returns the number of milliseconds to sleep between runs of the idle object evictor thread.

Usage

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

private void assertConfiguration(GenericObjectPool.Config expected, GenericObjectPool actual) throws Exception {
    assertEquals("testOnBorrow", expected.testOnBorrow, actual.getTestOnBorrow());
    assertEquals("testOnReturn", expected.testOnReturn, actual.getTestOnReturn());
    assertEquals("testWhileIdle", expected.testWhileIdle, actual.getTestWhileIdle());
    assertEquals("whenExhaustedAction", expected.whenExhaustedAction, actual.getWhenExhaustedAction());
    assertEquals("maxActive", expected.maxActive, actual.getMaxActive());
    assertEquals("maxIdle", expected.maxIdle, actual.getMaxIdle());
    assertEquals("maxWait", expected.maxWait, actual.getMaxWait());
    assertEquals("minEvictableIdleTimeMillis", expected.minEvictableIdleTimeMillis,
            actual.getMinEvictableIdleTimeMillis());
    assertEquals("numTestsPerEvictionRun", expected.numTestsPerEvictionRun, actual.getNumTestsPerEvictionRun());
    assertEquals("timeBetweenEvictionRunsMillis", expected.timeBetweenEvictionRunsMillis,
            actual.getTimeBetweenEvictionRunsMillis());
}

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

public void testSettersAndGetters() throws Exception {
    GenericObjectPool pool = new GenericObjectPool();
    {/*w ww.  j  av  a 2  s  . co 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();
}