Return-Path: X-Original-To: apmail-commons-notifications-archive@minotaur.apache.org Delivered-To: apmail-commons-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 979A318F7A for ; Wed, 27 May 2015 15:48:39 +0000 (UTC) Received: (qmail 98694 invoked by uid 500); 27 May 2015 15:48:39 -0000 Delivered-To: apmail-commons-notifications-archive@commons.apache.org Received: (qmail 98621 invoked by uid 500); 27 May 2015 15:48:39 -0000 Mailing-List: contact notifications-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list notifications@commons.apache.org Received: (qmail 98510 invoked by uid 99); 27 May 2015 15:48:39 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 May 2015 15:48:39 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 4267AAC0BBE for ; Wed, 27 May 2015 15:48:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r952883 [5/37] - in /websites/production/commons/content/proper/commons-pool/api-2.4: ./ org/ org/apache/ org/apache/commons/ org/apache/commons/pool2/ org/apache/commons/pool2/class-use/ org/apache/commons/pool2/impl/ org/apache/commons/po... Date: Wed, 27 May 2015 15:48:36 -0000 To: notifications@commons.apache.org From: psteitz@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150527154839.4267AAC0BBE@hades.apache.org> Added: websites/production/commons/content/proper/commons-pool/api-2.4/org/apache/commons/pool2/KeyedPooledObjectFactory.html ============================================================================== --- websites/production/commons/content/proper/commons-pool/api-2.4/org/apache/commons/pool2/KeyedPooledObjectFactory.html (added) +++ websites/production/commons/content/proper/commons-pool/api-2.4/org/apache/commons/pool2/KeyedPooledObjectFactory.html Wed May 27 15:48:33 2015 @@ -0,0 +1,433 @@ + + + + + + +KeyedPooledObjectFactory (Apache Commons Pool 2.4 API) + + + + + + + + + + + +
+
org.apache.commons.pool2
+

Interface KeyedPooledObjectFactory<K,V>

+
+
+
+ +
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        makeObject

        +
        PooledObject<VmakeObject(K key)
        +                    throws Exception
        +
        Create an instance that can be served by the pool and + wrap it in a PooledObject to be managed by the pool.
        +
        +
        Parameters:
        +
        key - the key used when constructing the object
        +
        Returns:
        +
        a PooledObject wrapping an instance that can + be served by the pool.
        +
        Throws:
        +
        Exception - if there is a problem creating a new instance, + this will be propagated to the code requesting an object.
        +
        +
      • +
      + + + + + +
        +
      • +

        destroyObject

        +
        void destroyObject(K key,
        +                   PooledObject<V> p)
        +            throws Exception
        +
        Destroy an instance no longer needed by the pool. +

        + It is important for implementations of this method to be aware that there + is no guarantee about what state obj will be in and the + implementation should be prepared to handle unexpected errors. +

        + Also, an implementation must take in to consideration that instances lost + to the garbage collector may never be destroyed.

        +
        +
        Parameters:
        +
        key - the key used when selecting the instance
        +
        p - a PooledObject wrapping the instance to be destroyed
        +
        Throws:
        +
        Exception - should be avoided as it may be swallowed by + the pool implementation.
        +
        See Also:
        +
        validateObject(K, org.apache.commons.pool2.PooledObject<V>), +KeyedObjectPool.invalidateObject(K, V)
        +
        +
      • +
      + + + + + +
        +
      • +

        validateObject

        +
        boolean validateObject(K key,
        +                       PooledObject<V> p)
        +
        Ensures that the instance is safe to be returned by the pool.
        +
        +
        Parameters:
        +
        key - the key used when selecting the object
        +
        p - a PooledObject wrapping the instance to be validated
        +
        Returns:
        +
        false if obj is not valid and should + be dropped from the pool, true otherwise.
        +
        +
      • +
      + + + + + + + + + + + + +
    • +
    +
  • +
+
+
+ + + + + +

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.

+ + Propchange: websites/production/commons/content/proper/commons-pool/api-2.4/org/apache/commons/pool2/KeyedPooledObjectFactory.html ------------------------------------------------------------------------------ svn:eol-style = native Added: websites/production/commons/content/proper/commons-pool/api-2.4/org/apache/commons/pool2/ObjectPool.html ============================================================================== --- websites/production/commons/content/proper/commons-pool/api-2.4/org/apache/commons/pool2/ObjectPool.html (added) +++ websites/production/commons/content/proper/commons-pool/api-2.4/org/apache/commons/pool2/ObjectPool.html Wed May 27 15:48:33 2015 @@ -0,0 +1,481 @@ + + + + + + +ObjectPool (Apache Commons Pool 2.4 API) + + + + + + + + + + + +
+
org.apache.commons.pool2
+

Interface ObjectPool<T>

+
+
+
+
    +
  • +
    +
    Type Parameters:
    +
    T - Type of element pooled in this pool.
    +
    +
    +
    All Known Implementing Classes:
    +
    BaseObjectPool, GenericObjectPool, ProxiedObjectPool, SoftReferenceObjectPool
    +
    +
    +
    +
    public interface ObjectPool<T>
    +
    A pooling simple interface. +

    + Example of use: +

     Object obj = null;
    +
    + try {
    +     obj = pool.borrowObject();
    +     try {
    +         //...use the object...
    +     } catch(Exception e) {
    +         // invalidate the object
    +         pool.invalidateObject(obj);
    +         // do not return the object to the pool twice
    +         obj = null;
    +     } finally {
    +         // make sure the object is returned to the pool
    +         if(null != obj) {
    +             pool.returnObject(obj);
    +        }
    +     }
    + } catch(Exception e) {
    +       // failed to borrow an object
    + }
    +

    + See BaseObjectPool for a simple base implementation.

    +
    +
    Since:
    +
    2.0
    +
    Version:
    +
    $Revision: 1566605 $
    +
    See Also:
    +
    PooledObjectFactory, +KeyedObjectPool, +BaseObjectPool
    +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethod and Description
      voidaddObject() +
      Create an object using the factory or other + implementation dependent mechanism, passivate it, and then place it in + the idle object pool.
      +
      TborrowObject() +
      Obtains an instance from this pool.
      +
      voidclear() +
      Clears any objects sitting idle in the pool, releasing any associated + resources (optional operation).
      +
      voidclose() +
      Close this pool, and free any resources associated with it.
      +
      intgetNumActive() +
      Return the number of instances currently borrowed from this pool.
      +
      intgetNumIdle() +
      Return the number of instances currently idle in this pool.
      +
      voidinvalidateObject(T obj) +
      Invalidates an object from the pool.
      +
      voidreturnObject(T obj) +
      Return an instance to the pool.
      +
      +
    • +
    +
  • +
+
+
+ +
+
+ + + + + +

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.

+ + Propchange: websites/production/commons/content/proper/commons-pool/api-2.4/org/apache/commons/pool2/ObjectPool.html ------------------------------------------------------------------------------ svn:eol-style = native