1 22 package org.jboss.ejb.plugins; 23 24 import org.jboss.ejb.BeanLock; 25 import org.jboss.invocation.Invocation; 26 27 57 public class EntityLockInterceptor 58 extends AbstractInterceptor 59 { 60 62 64 66 68 70 72 public Object invokeHome(Invocation mi) 73 throws Exception 74 { 75 return getNext().invokeHome(mi); 77 78 } 79 80 public Object invoke(Invocation mi) 81 throws Exception 82 { 83 84 Object key = mi.getId(); 86 87 BeanLock lock ; 89 90 boolean threadIsScheduled = false; 91 boolean trace = log.isTraceEnabled(); 92 93 if( trace ) log.trace("Begin invoke, key="+key); 94 95 96 lock = container.getLockManager().getLock(key); 97 try 98 { 99 100 lock.schedule(mi); 101 102 try { 103 104 return getNext().invoke(mi); 105 } 106 107 finally 108 { 109 110 lock.sync(); 113 lock.endInvocation(mi); 114 lock.releaseSync(); 115 } 116 } 117 finally 118 { 119 120 container.getLockManager().removeLockRef(key); 122 123 if( trace ) log.trace("End invoke, key="+key); 124 } 125 } 126 } 127 128 | Popular Tags |