1 13 14 package org.dbunit.util.concurrent; 15 16 178 179 public class SynchronizedVariable implements Executor { 180 181 protected final Object lock_; 182 183 184 public SynchronizedVariable(Object lock) { lock_ = lock; } 185 186 187 public SynchronizedVariable() { lock_ = this; } 188 189 192 public Object getLock() { return lock_; } 193 194 198 199 public void execute(Runnable command) throws InterruptedException { 200 if (Thread.interrupted()) throw new InterruptedException (); 201 synchronized (lock_) { 202 command.run(); 203 } 204 } 205 } 206 | Popular Tags |