1 /* JFox, the OpenSource J2EE Application Server 2 * 3 * Distributable under GNU LGPL license by gun.org 4 * more details please visit http://www.huihoo.org/jfox 5 */ 6 7 package org.jfox.pool; 8 9 /** 10 * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a> 11 */ 12 13 14 public interface PoolableObject { 15 16 /** 17 * actvite the object before it be retrived 18 */ 19 void activate() throws Exception; 20 21 /** 22 * passivate the object before it be restored, set the status to initialized 23 */ 24 void passivate() throws Exception; 25 26 /** 27 * 表明该对象是否能返回到池中 28 * 注意,如果一个对象已在池中,该方法也应该返回 false,表明该对象不可被使用 29 */ 30 boolean isAvailable(); 31 32 /** 33 * get the time that the poolable object has sleeped in the pool 34 * <p/> 35 * pool can decide whether to remove it according the time 36 * 37 * @return 38 */ 39 long getSleepTime(); 40 }