KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > containers > util > pool > Pool


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /**
25  * <BR> <I>$Source: /cvs/glassfish/appserv-core/src/java/com/sun/ejb/containers/util/pool/Pool.java,v $</I>
26  * @author $Author: tcfujii $
27  * @version $Revision: 1.3 $ $Date: 2005/12/25 04:13:35 $
28  */

29  
30 package com.sun.ejb.containers.util.pool;
31
32 /**
33  * Pool defines the methods that can be used by the application to access
34  * pooled objects. The basic assumption is that all objects in the pool are
35  * identical (homogeneous). This interface defines methods for a) getting an
36  * object from the pool, b) returning an object back to the pool
37  * and, c) destroying (instead of reusing) an object. In addition to these
38  * methods, the Pool has methods for adding and removing PoolEventListeners.
39  * There are six overloaded methods for getting objects from a pool.
40  *
41  */

42 public interface Pool {
43     
44     /**
45        @deprecated
46     */

47     public Object JavaDoc getObject(boolean canWait, Object JavaDoc param)
48         throws PoolException;
49     
50     /**
51        @deprecated
52     */

53     public Object JavaDoc getObject(long maxWaitTime, Object JavaDoc param)
54         throws PoolException;
55     
56     /**
57      * Get an object from the pool within the specified time.
58      * @param The amount of time the calling thread agrees to wait.
59      * @param Some value that might be used while creating the object
60      * @return an Object or null if an object could not be returned in
61      * 'waitForMillis' millisecond.
62      * @exception Throws PoolException if an object cannot be created
63      */

64     public Object JavaDoc getObject(Object JavaDoc param)
65         throws PoolException;
66
67     /**
68      * Return an object back to the pool. An object that is obtained through
69      * getObject() must always be returned back to the pool using either
70      * returnObject(obj) or through destroyObject(obj).
71      */

72     public void returnObject(Object JavaDoc obj);
73                 
74     /**
75      * Destroys an Object. Note that applications should not ignore the
76      * reference to the object that they got from getObject(). An object
77      * that is obtained through getObject() must always be returned back to
78      * the pool using either returnObject(obj) or through destroyObject(obj).
79      * This method tells that the object should be destroyed and cannot be
80      * reused.
81      *
82      */

83     public void destroyObject(Object JavaDoc obj);
84         
85 }
86
Popular Tags