1 22 package org.jboss.ejb.plugins; 23 24 import java.rmi.NoSuchObjectException ; 25 import java.rmi.RemoteException ; 26 import org.jboss.ejb.EnterpriseContext; 27 28 44 45 public class StatefulHASessionInstanceCache 46 extends StatefulSessionInstanceCache 47 { 48 49 51 53 55 57 59 65 public void invalidateLocally (Object id) 66 { 67 if (id == null) return; 68 69 try 70 { 71 getCache().remove(id); 72 } 73 catch (Exception e) 74 { 75 log.debug (e); 76 } 77 } 78 79 81 83 90 public EnterpriseContext get(Object id) 91 throws RemoteException , NoSuchObjectException 92 { 93 if (id == null) throw new IllegalArgumentException ("Can't get an object with a null key"); 94 95 EnterpriseContext ctx = null; 96 97 synchronized (getCacheLock()) 98 { 99 ctx = (EnterpriseContext)getCache().get(id); 100 if (ctx != null) 101 { 102 return ctx; 103 } 104 } 105 106 try 111 { 112 ctx = acquireContext(); 113 setKey(id, ctx); 114 activate(ctx); 115 logActivation(id); 116 insert(ctx); 117 } 118 catch (Exception x) 119 { 120 if (ctx != null) 121 freeContext(ctx); 122 log.debug("Activation failure, id="+id, x); 123 throw new NoSuchObjectException (x.getMessage()); 124 } 125 126 if (ctx == null) throw new NoSuchObjectException ("Can't find bean with id = " + id); 128 129 return ctx; 130 } 131 132 133 134 136 138 140 142 } 143 | Popular Tags |