KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > util > ObjectPool


1 /*
2  * $Id: ObjectPool.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.util;
12
13 /**
14  * <code>ObjectPool</code> is a simple pooling interface for objects
15  */

16 public interface ObjectPool
17 {
18     /**
19      * Constants used to determine the exhaused action of the pool
20      */

21     static final int WHEN_EXHAUSTED_FAIL = 0;
22     static final int WHEN_EXHAUSTED_BLOCK = 1;
23     static final int WHEN_EXHAUSTED_GROW = 2;
24
25     static final int DEFAULT_MAX_SIZE = 5;
26     static final int DEFAULT_MAX_WAIT = 4000;
27     static final int DEFAULT_EXHAUSTED_ACTION = WHEN_EXHAUSTED_BLOCK;
28
29     Object JavaDoc borrowObject() throws Exception JavaDoc;
30
31     void returnObject(Object JavaDoc object) throws Exception JavaDoc;
32
33     int getSize();
34
35     int getMaxSize();
36
37     void setFactory(ObjectFactory factory);
38
39     void clearPool();
40
41     void start() throws Exception JavaDoc;
42
43     void stop() throws Exception JavaDoc;
44
45     void onAdd(Object JavaDoc obj);
46
47     void onRemove(Object JavaDoc obj);
48
49 }
50
Popular Tags