1 6 7 package org.jfox.pool; 8 9 12 13 public abstract class AbstractPoolableObject implements PoolableObject { 14 private boolean available = false; 15 16 private long passivateTime = System.currentTimeMillis(); 17 18 public void activate() throws Exception { 19 available = true; 20 passivateTime = System.currentTimeMillis(); 21 } 22 23 public void passivate() throws Exception { 25 available = false; 26 passivateTime = System.currentTimeMillis(); 27 } 28 29 public boolean isAvailable() { 30 return available; 31 } 32 33 public long getSleepTime() { 34 return System.currentTimeMillis() - passivateTime; 35 } 36 } | Popular Tags |