/Users/lyon/j4p/src/classUtils/pack/util/pool2/PooledObject.java
|
1 package classUtils.pack.util.pool2;
2
3 import classUtils.pack.util.pool2.*;
4
5 /**
6 * A pooled object is a stub for its original object, which is
7 * accessible via the same interface.
8 * <p>
9 * The original underlying object is not necessarily in core; if a
10 * {@link BasePassivationManager passivation manager class} is
11 * associated with the {@link ObjectPool ObjectPool} containing the
12 * object, and the object is passivable according to that manager,
13 * the original object may be passivated on some secondary storage.
14 *
15 * @author Cristiano Sadun
16 *
17 */
18 public interface PooledObject {
19
20 /**
21 * Activate the object, if necessary, and returns the original
22 * object. The object stays in core until is released by
23 * {@link #_releaseOriginal() releaseOriginal()}.
24 */
25 public Object _getOriginal() throws ActivationException;
26
27 /**
28 * Release the original, marking it as passivable.
29 */
30 public void _releaseOriginal();
31
32 /**
33 * Passivate the object - storing it on secondary storage and
34 * freeing core memory.
35 */
36 public void _passivate() throws PassivationException;
37
38 /**
39 * Activate the object - retrieving it from secondary memory.
40 * The object is still passivable.
41 */
42 public void _activate() throws ActivationException;
43
44 /**
45 * Return the invariant passivable.state
46 * @return boolean
47 */
48 public boolean _isPassivable();
49
50 /**
51 * Return the current passivable.state
52 * @return boolean
53 */
54 public boolean _isPassivableNow();
55
56 /**
57 * Return the passivate.state
58 * @return boolean
59 */
60 public boolean _isPassivated();
61
62 }
63