01: // ***************************************************************
02: // * *
03: // * File: NullObjectPool.java *
04: // * *
05: // * Copyright (c) 2002 Sun Microsystems, Inc. *
06: // * All rights reserved. *
07: // * *
08: // * *
09: // * Author - alejandro.abdelnur@sun.com *
10: // * *
11: // ***************************************************************
12:
13: package com.sun.portal.common.pool;
14:
15: public class NullObjectPool implements Pool {
16: private ObjectManager _objectManager;
17: private boolean _destroyed;
18: private int _leased;
19:
20: public NullObjectPool(ObjectManager objectManager) {
21: _objectManager = objectManager;
22: _destroyed = false;
23: }
24:
25: public Object obtainObject(Object param) {
26: if (_destroyed) {
27: throw new IllegalStateException();
28: }
29: _leased++;
30: return _objectManager.createObject(param);
31: }
32:
33: public void releaseObject(Object o) {
34: _objectManager.destroyObject(o);
35: _leased--;
36: }
37:
38: public int getLeased() {
39: return _leased;
40: }
41:
42: public int getMinSize() {
43: return 0;
44: }
45:
46: public int getMaxSize() {
47: return 0;
48: }
49:
50: public void setMaxSize(int maxSize) {
51: }
52:
53: public void destroy() {
54: _destroyed = true;
55: }
56:
57: public final boolean doesReuseObjects() {
58: return false;
59: }
60:
61: }
|