1 package org.objectweb.perseus.concurrency.distributed.globallock; 2 3 import org.objectweb.perseus.concurrency.distributed.globallock.api.GlobalLock; 4 import org.objectweb.perseus.concurrency.distributed.globallock.api.GlobalLockException; 5 import org.objectweb.perseus.concurrency.distributed.globallock.lib.BasicGlobalLockManager; 6 import org.objectweb.perseus.concurrency.distributed.globallock.lib.GlobalLockUser; 7 import org.objectweb.perseus.distribution.api.DistResServiceManager; 8 import org.objectweb.perseus.distribution.api.DistResCoordinatorFactory; 9 import org.objectweb.perseus.distribution.util.MessageEventListenerRegistry; 10 import java.io.Serializable ; 11 12 36 public class GlobalLockManagerInterceptor extends BasicGlobalLockManager { 37 MessageEventListenerRegistry reg; 38 39 public GlobalLockManagerInterceptor(DistResServiceManager drsm, 40 DistResCoordinatorFactory drcf, 41 MessageEventListenerRegistry reg) { 42 super(drsm, drcf); 43 this.reg = reg; 44 } 45 46 47 protected GlobalLock createLock(Serializable resId) { 48 GlobalLockUser gl = (GlobalLockUser) super.createLock(resId); 49 GlobalLockInterceptor gli = new GlobalLockInterceptor(gl, reg); 50 return gli; 51 } 52 53 protected void joinUsers(Serializable oid) throws GlobalLockException { 54 GlobalLockInterceptor gli = (GlobalLockInterceptor) distlocks.get(oid); 55 UserInterceptor ui = new UserInterceptor(gli.glu, nodeId); 56 try { 57 drus.joinUsers(oid, ui); 58 } catch (Exception e) { 59 throw new GlobalLockException(e); 60 } 61 } 62 63 64 } 65 | Popular Tags |