1 16 17 package org.springframework.scheduling; 18 19 23 public class TestMethodInvokingTask { 24 25 public int counter = 0; 26 27 private Object lock = new Object (); 28 29 public void doSomething() { 30 this.counter++; 31 } 32 33 public void doWait() { 34 this.counter++; 35 synchronized (this.lock) { 37 try { 38 this.lock.wait(); 39 } 40 catch (InterruptedException e) { 41 } 43 } 44 } 45 46 public void stop() { 47 synchronized(this.lock) { 48 this.lock.notify(); 49 } 50 } 51 52 } 53 | Popular Tags |