congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PoolUtils.checkMinIdle
Code IndexAdd Tabnine to your IDE (free)

How to use
checkMinIdle
method
in
org.apache.commons.pool2.PoolUtils

Best Java code snippets using org.apache.commons.pool2.PoolUtils.checkMinIdle (Showing top 6 results out of 315)

origin: org.apache.commons/commons-pool2

while (iter.hasNext()) {
  final K key = iter.next();
  final TimerTask task = checkMinIdle(keyedPool, key, minIdle, period);
  tasks.put(key, task);
origin: org.apache.commons/commons-pool2

@Test
public void testCheckMinIdleKeyedObjectPoolKeysNulls() throws Exception {
  try (@SuppressWarnings("unchecked")
    final KeyedObjectPool<Object,Object> pool = createProxy(KeyedObjectPool.class, (List<String>)null)) {
    PoolUtils.checkMinIdle(pool, (Collection<?>) null, 1, 1);
    fail("PoolUtils.checkMinIdle(KeyedObjectPool,Collection,int,long) must not accept null keys.");
  } catch (final IllegalArgumentException iae) {
    // expected
  }
  try (@SuppressWarnings("unchecked")
    final KeyedObjectPool<Object,Object> pool = createProxy(KeyedObjectPool.class, (List<String>)null)) {
    PoolUtils.checkMinIdle(pool, (Collection<?>) Collections.emptyList(), 1, 1);
  } catch (final IllegalArgumentException iae) {
    fail("PoolUtils.checkMinIdle(KeyedObjectPool,Collection,int,long) must accept empty lists.");
  }
}
origin: org.apache.commons/commons-pool2

keys.add("two");
final Map<String, TimerTask> tasks = PoolUtils.checkMinIdle(pool, keys, 1, CHECK_PERIOD);
origin: org.apache.commons/commons-pool2

@Test
public void testCheckMinIdleObjectPool() throws Exception {
  try {
    PoolUtils.checkMinIdle(null, 1, 1);
    fail("PoolUtils.checkMinIdle(ObjectPool,,) must not allow null pool.");
  } catch (final IllegalArgumentException iae) {
    PoolUtils.checkMinIdle(pool, -1, 1);
    fail("PoolUtils.checkMinIdle(ObjectPool,,) must not accept negative min idle values.");
  } catch (final IllegalArgumentException iae) {
  final PooledObjectFactory<Object> pof = createProxy(PooledObjectFactory.class, calledMethods);
  try (final ObjectPool<Object> op = new GenericObjectPool<>(pof)) {
    PoolUtils.checkMinIdle(op, 2, 100);
    Thread.sleep(1000);
    assertEquals(2, op.getNumIdle());
      try (@SuppressWarnings("unchecked")
        final ObjectPool<Object> pool = createProxy(ObjectPool.class, calledMethods)) {
        final TimerTask task = PoolUtils.checkMinIdle(pool, 1, CHECK_PERIOD); // checks minIdle immediately
origin: org.apache.commons/commons-pool2

@Test
public void testCheckMinIdleKeyedObjectPool() throws Exception {
  try {
    PoolUtils.checkMinIdle(null, new Object(), 1, 1);
    fail("PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not allow null pool.");
  } catch (final IllegalArgumentException iae) {
    PoolUtils.checkMinIdle(pool, (Object)null, 1, 1);
    fail("PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not accept null keys.");
  } catch (final IllegalArgumentException iae) {
    PoolUtils.checkMinIdle(pool, new Object(), -1, 1);
    fail("PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not accept negative min idle values.");
  } catch (final IllegalArgumentException iae) {
  try (final KeyedObjectPool<Object,Object> kop =
      new GenericKeyedObjectPool<>(kpof)) {
    PoolUtils.checkMinIdle(kop, key, 2, 100);
    Thread.sleep(400);
    assertEquals(2, kop.getNumIdle(key));
      final KeyedObjectPool<Object, Object> pool = createProxy(KeyedObjectPool.class, calledMethods)) {
        final TimerTask task = PoolUtils.checkMinIdle(pool, key, 1, CHECK_PERIOD);
origin: org.apache.directory.api/api-ldap-client-all

while (iter.hasNext()) {
  final K key = iter.next();
  final TimerTask task = checkMinIdle(keyedPool, key, minIdle, period);
  tasks.put(key, task);
org.apache.commons.pool2PoolUtilscheckMinIdle

Javadoc

Periodically check the idle object count for the key in the keyedPool. At most one idle object will be added per period. If there is an exception when calling KeyedObjectPool#addObject(Object) then no more checks for that key will be performed.

Popular methods of PoolUtils

  • checkRethrow
    Should the supplied Throwable be re-thrown (eg if it is an instance of one of the Throwables that sh
  • erodingPool
    Returns a pool that adaptively decreases its size when idle objects are no longer needed. This is in
  • prefill
    Calls ObjectPool#addObject() on pool count number of times.
  • synchronizedPool
    Returns a synchronized (thread-safe) ObjectPool backed by the specified ObjectPool.Note: This should
  • getMinIdleTimer
    Gets the Timer for checking keyedPool's idle count.
  • synchronizedPooledFactory
    Returns a synchronized (thread-safe) PooledObjectFactory backed by the specified PooledObjectFactory
  • <init>
    PoolUtils instances should NOT be constructed in standard programming. Instead, the class should be
  • synchronizedKeyedPooledFactory
    Returns a synchronized (thread-safe) KeyedPooledObjectFactory backed by the specified KeyedPoolableO

Popular in Java

  • Reading from database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • compareTo (BigDecimal)
  • getSystemService (Context)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now