/** * Periodically check the idle object count for the pool. At most one idle object will be added per period. * If there is an exception when calling {@link ObjectPool#addObject()} then no more checks will be performed. * * @param <T> the type of object * @param pool the pool to check periodically. * @param minIdle if the {@link ObjectPool#getNumIdle()} is less than this then add an idle object. * @param period the frequency to check the number of idle objects in a pool, see * {@link Timer#schedule(TimerTask, long, long)}. * @return the {@link TimerTask} that will periodically check the pools idle object count. * @throws IllegalArgumentException when <code>pool</code> is <code>null</code> or * when <code>minIdle</code> is negative or when <code>period</code> isn't * valid for {@link Timer#schedule(TimerTask, long, long)}. * @since Pool 1.3 */ public static <T> TimerTask checkMinIdle(final ObjectPool<T> pool, final int minIdle, final long period) throws IllegalArgumentException { if (pool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (minIdle < 0) { throw new IllegalArgumentException("minIdle must be non-negative."); } final TimerTask task = new ObjectPoolMinIdleTimerTask<T>(pool, minIdle); getMinIdleTimer().schedule(task, 0L, period); return task; }
getMinIdleTimer().schedule(task, 0L, period); return task;
/** * Periodically check the idle object count for the pool. At most one idle object will be added per period. * If there is an exception when calling {@link ObjectPool#addObject()} then no more checks will be performed. * * @param <T> the type of object * @param pool the pool to check periodically. * @param minIdle if the {@link ObjectPool#getNumIdle()} is less than this then add an idle object. * @param period the frequency to check the number of idle objects in a pool, see * {@link Timer#schedule(TimerTask, long, long)}. * @return the {@link TimerTask} that will periodically check the pools idle object count. * @throws IllegalArgumentException when <code>pool</code> is <code>null</code> or * when <code>minIdle</code> is negative or when <code>period</code> isn't * valid for {@link Timer#schedule(TimerTask, long, long)}. * @since Pool 1.3 */ public static <T> TimerTask checkMinIdle(final ObjectPool<T> pool, final int minIdle, final long period) throws IllegalArgumentException { if (pool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (minIdle < 0) { throw new IllegalArgumentException("minIdle must be non-negative."); } final TimerTask task = new ObjectPoolMinIdleTimerTask<T>(pool, minIdle); getMinIdleTimer().schedule(task, 0L, period); return task; }
/** * Periodically check the idle object count for the pool. At most one idle object will be added per period. * If there is an exception when calling {@link ObjectPool#addObject()} then no more checks will be performed. * * @param <T> the type of object * @param pool the pool to check periodically. * @param minIdle if the {@link ObjectPool#getNumIdle()} is less than this then add an idle object. * @param period the frequency to check the number of idle objects in a pool, see * {@link Timer#schedule(TimerTask, long, long)}. * @return the {@link TimerTask} that will periodically check the pools idle object count. * @throws IllegalArgumentException when <code>pool</code> is <code>null</code> or * when <code>minIdle</code> is negative or when <code>period</code> isn't * valid for {@link Timer#schedule(TimerTask, long, long)}. * @since Pool 1.3 */ public static <T> TimerTask checkMinIdle(final ObjectPool<T> pool, final int minIdle, final long period) throws IllegalArgumentException { if (pool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (minIdle < 0) { throw new IllegalArgumentException("minIdle must be non-negative."); } final TimerTask task = new ObjectPoolMinIdleTimerTask<T>(pool, minIdle); getMinIdleTimer().schedule(task, 0L, period); return task; }
/** * Periodically check the idle object count for the pool. At most one idle object will be added per period. * If there is an exception when calling {@link ObjectPool#addObject()} then no more checks will be performed. * * @param pool the pool to check periodically. * @param minIdle if the {@link ObjectPool#getNumIdle()} is less than this then add an idle object. * @param period the frequency to check the number of idle objects in a pool, see * {@link Timer#schedule(TimerTask, long, long)}. * @return the {@link TimerTask} that will periodically check the pools idle object count. * @throws IllegalArgumentException when <code>pool</code> is <code>null</code> or * when <code>minIdle</code> is negative or when <code>period</code> isn't * valid for {@link Timer#schedule(TimerTask, long, long)}. * @since Pool 1.3 */ public static TimerTask checkMinIdle(final ObjectPool pool, final int minIdle, final long period) throws IllegalArgumentException { if (pool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (minIdle < 0) { throw new IllegalArgumentException("minIdle must be non-negative."); } final TimerTask task = new ObjectPoolMinIdleTimerTask(pool, minIdle); getMinIdleTimer().schedule(task, 0L, period); return task; }
/** * Periodically check the idle object count for the pool. At most one idle object will be added per period. * If there is an exception when calling {@link ObjectPool#addObject()} then no more checks will be performed. * * @param pool the pool to check periodically. * @param minIdle if the {@link ObjectPool#getNumIdle()} is less than this then add an idle object. * @param period the frequency to check the number of idle objects in a pool, see * {@link Timer#schedule(TimerTask, long, long)}. * @return the {@link TimerTask} that will periodically check the pools idle object count. * @throws IllegalArgumentException when <code>pool</code> is <code>null</code> or * when <code>minIdle</code> is negative or when <code>period</code> isn't * valid for {@link Timer#schedule(TimerTask, long, long)}. * @since Pool 1.3 */ public static TimerTask checkMinIdle(final ObjectPool pool, final int minIdle, final long period) throws IllegalArgumentException { if (pool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (minIdle < 0) { throw new IllegalArgumentException("minIdle must be non-negative."); } final TimerTask task = new ObjectPoolMinIdleTimerTask(pool, minIdle); getMinIdleTimer().schedule(task, 0L, period); return task; }
/** * 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 {@link KeyedObjectPool#addObject(Object)} then no more checks for that key * will be performed. * * @param keyedPool the keyedPool to check periodically. * @param key the key to check the idle count of. * @param minIdle if the {@link KeyedObjectPool#getNumIdle(Object)} is less than this then add an idle object. * @param period the frequency to check the number of idle objects in a keyedPool, see * {@link Timer#schedule(TimerTask, long, long)}. * @return the {@link TimerTask} that will periodically check the pools idle object count. * @throws IllegalArgumentException when <code>keyedPool</code>, <code>key</code> is <code>null</code> or * when <code>minIdle</code> is negative or when <code>period</code> isn't * valid for {@link Timer#schedule(TimerTask, long, long)}. * @since Pool 1.3 */ public static TimerTask checkMinIdle(final KeyedObjectPool keyedPool, final Object key, final int minIdle, final long period) throws IllegalArgumentException { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (key == null) { throw new IllegalArgumentException("key must not be null."); } if (minIdle < 0) { throw new IllegalArgumentException("minIdle must be non-negative."); } final TimerTask task = new KeyedObjectPoolMinIdleTimerTask(keyedPool, key, minIdle); getMinIdleTimer().schedule(task, 0L, period); return task; }
/** * 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 {@link KeyedObjectPool#addObject(Object)} then no more checks for that key * will be performed. * * @param keyedPool the keyedPool to check periodically. * @param key the key to check the idle count of. * @param minIdle if the {@link KeyedObjectPool#getNumIdle(Object)} is less than this then add an idle object. * @param period the frequency to check the number of idle objects in a keyedPool, see * {@link Timer#schedule(TimerTask, long, long)}. * @return the {@link TimerTask} that will periodically check the pools idle object count. * @throws IllegalArgumentException when <code>keyedPool</code>, <code>key</code> is <code>null</code> or * when <code>minIdle</code> is negative or when <code>period</code> isn't * valid for {@link Timer#schedule(TimerTask, long, long)}. * @since Pool 1.3 */ public static TimerTask checkMinIdle(final KeyedObjectPool keyedPool, final Object key, final int minIdle, final long period) throws IllegalArgumentException { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (key == null) { throw new IllegalArgumentException("key must not be null."); } if (minIdle < 0) { throw new IllegalArgumentException("minIdle must be non-negative."); } final TimerTask task = new KeyedObjectPoolMinIdleTimerTask(keyedPool, key, minIdle); getMinIdleTimer().schedule(task, 0L, period); return task; }
getMinIdleTimer().schedule(task, 0L, period); return task;
getMinIdleTimer().schedule(task, 0L, period); return task;