标签:wait 结果 interrupt async row test creat this void
public class TestUtil {
public static AsyncTest createAsyncTest() {
return new AsyncTest();
}
public static class AsyncTest<T> {
private T result;
private CountDownLatch countDownLatch=new CountDownLatch(1);
public T getResult() throws InterruptedException {
countDownLatch.await();
return result;
}
public void setResult(T result) {
this.result = result;
countDownLatch.countDown();
}
}
}
标签:wait 结果 interrupt async row test creat this void
原文地址:http://blog.51cto.com/13923464/2328616