Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ObjectPool |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: ObjectPool.java 7963 2007-08-21 08:53:15Z dirk.olmes $ | |
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 CPAL v1.0 | |
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 exhausted action of the pool | |
20 | */ | |
21 | int WHEN_EXHAUSTED_FAIL = 0; | |
22 | /** @deprecated use WHEN_EXHAUSTED_WAIT instead */ | |
23 | int WHEN_EXHAUSTED_BLOCK = 1; | |
24 | int WHEN_EXHAUSTED_WAIT = 1; | |
25 | int WHEN_EXHAUSTED_GROW = 2; | |
26 | int DEFAULT_EXHAUSTED_ACTION = WHEN_EXHAUSTED_WAIT; | |
27 | ||
28 | int DEFAULT_MAX_SIZE = 5; | |
29 | int DEFAULT_MAX_WAIT = 4000; | |
30 | ||
31 | Object borrowObject() throws Exception; | |
32 | ||
33 | void returnObject(Object object) throws Exception; | |
34 | ||
35 | int getSize(); | |
36 | ||
37 | int getMaxSize(); | |
38 | ||
39 | void setFactory(ObjectFactory factory); | |
40 | ||
41 | void clearPool(); | |
42 | ||
43 | void start() throws Exception; | |
44 | ||
45 | void stop() throws Exception; | |
46 | ||
47 | void onAdd(Object obj); | |
48 | ||
49 | void onRemove(Object obj); | |
50 | ||
51 | } |