1 23 24 28 50 package com.sun.jts.CosTransactions; 51 52 65 72 public class EventSemaphore { 73 boolean posted = false; 74 75 83 EventSemaphore() { 84 } 85 86 94 EventSemaphore( boolean posted ) { 95 this.posted = posted; 96 } 97 98 101 synchronized public boolean isPosted() { 102 return posted; 103 } 104 105 117 synchronized public void waitEvent() 118 throws InterruptedException { 119 if( !posted ) 120 wait(); 121 } 122 123 133 synchronized void post() { 134 if( !posted ) 135 notifyAll(); 136 posted = true; 137 } 138 139 147 synchronized void clear() { 148 posted = false; 149 } 150 } 151 | Popular Tags |