1 24 25 package org.objectweb.perseus.concurrency.distributed.globallock; 26 27 import org.objectweb.perseus.concurrency.distributed.AbstractLockingAction; 28 import org.objectweb.perseus.concurrency.distributed.globallock.api.GlobalLock; 29 30 public class Upgrade extends AbstractLockingAction { 31 GlobalLockInterceptor h; 32 boolean waitNotGrantable; 33 34 public Upgrade(GlobalLockInterceptor h, byte expBehaviour, 35 byte execMode, byte lck, boolean waitNotGrantable) { 36 super(h.getName(), expBehaviour, execMode, lck); 37 this.h = h; 38 this.waitNotGrantable = waitNotGrantable; 39 } 40 41 42 protected void performBlockingAction() throws Exception { 43 44 if (waitNotGrantable) 45 while (h.getGrantable() >= lck) Thread.sleep(100); 46 47 48 h.upgrade(lck, true, 0); 49 60 } 61 62 final public String getBrief() { 63 return "U"; 64 } 65 66 protected String getLockingDescription() { 67 return "upgrade"; 68 } 69 70 } 71 | Popular Tags |