1 22 package org.jboss.ejb3.cache.tree; 23 24 import java.util.Map ; 25 26 import org.jboss.cache.Fqn; 27 import org.jboss.cache.Node; 28 import org.jboss.ejb3.stateful.StatefulBeanContext; 29 import org.jboss.logging.Logger; 30 31 38 public class StatefulEvictionPolicy extends PassivationEvictionPolicy 39 { 40 private static final Logger log = Logger.getLogger(StatefulEvictionPolicy.class); 41 42 public StatefulEvictionPolicy() 43 { 44 super(); 45 } 46 47 public void evict(Fqn fqn) throws Exception 48 { 49 if (fqn.size() == 2) 51 { 52 StatefulBeanContext bean = (StatefulBeanContext) cache_.get(fqn, "bean"); 53 54 if (bean == null) 55 { 56 super.evict(fqn); 57 return; 58 } 59 synchronized (bean) 60 { 61 if (bean.inUse) 62 { 63 bean.markedForPassivation = true; 64 super.evict(fqn); 65 return; 66 } 67 super.evict(fqn); 68 } 69 } 70 } 71 } 72 | Popular Tags |