1 22 package org.jboss.test.jmx.compliance.monitor.support; 23 24 import org.jboss.test.jmx.compliance.monitor.MonitorSUITE; 25 26 public class MonitorSupport 27 { 28 boolean done = false; 29 String last = "set"; 30 public synchronized void lock(String who) 31 { 32 if (!done && last.equals(who)) 33 { 34 try 35 { 36 wait(MonitorSUITE.MAX_WAIT); 37 } 38 catch (InterruptedException e) {} 39 if (!done && last.equals(who)) 40 throw new RuntimeException ("-- Time Out --"); 41 } 42 } 43 public synchronized void unlock(String who) 44 { 45 if (!done && last.equals(who)) 46 throw new RuntimeException ("-- Synchronization failure --"); 47 last=who; 48 notifyAll(); 49 } 50 public synchronized void end() 51 { 52 done = true; 53 notifyAll(); 54 } 55 } 56 | Popular Tags |