diff options
3 files changed, 28 insertions, 28 deletions
diff --git a/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java b/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java index 7619e4928f..0bf3328c31 100644 --- a/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java +++ b/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java @@ -43,27 +43,27 @@ public class StockQuoteClient { Object mutex = new Object();
Exception exception;
-// public float getPriceAsyncCallback(String ticker) throws Exception {
-// AsyncHandler<Float> callback = new AsyncHandler<Float>() {
-// public void handleResponse(Response<Float> arg) {
-// synchronized (mutex) {
-// try {
-// price = arg.get();
-// } catch (Exception e) {
-// exception = e;
-// }
-// mutex.notify();
-// }
-// }
-// };
-// stockQuote.getPriceAsync("foo", callback);
-// synchronized (mutex) {
-// if (price == 0f)
-// wait(5000); // wait for up to 5 seconds
-// }
-//
-// if (exception != null) throw exception;
-// return price;
-// }
+ public float getPriceAsyncCallback(String ticker) throws Exception {
+ AsyncHandler<Float> callback = new AsyncHandler<Float>() {
+ public void handleResponse(Response<Float> arg) {
+ synchronized (mutex) {
+ try {
+ price = arg.get();
+ } catch (Exception e) {
+ exception = e;
+ }
+ mutex.notify();
+ }
+ }
+ };
+ stockQuote.getPriceAsync("foo", callback);
+ synchronized (mutex) {
+ if (price == 0f)
+ mutex.wait(5000); // wait for up to 5 seconds
+ }
+
+ if (exception != null) throw exception;
+ return price;
+ }
}
diff --git a/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java b/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java index 6199996448..b15ab6be08 100644 --- a/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java +++ b/java/sca/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java @@ -35,5 +35,5 @@ public interface StockQuoteRef extends StockQuote { Response<Float> getPriceAsync(String ticker);
-// Future<?> getPriceAsync(String ticker, AsyncHandler<Float> callback);
+ Future<?> getPriceAsync(String ticker, AsyncHandler<Float> callback);
}
diff --git a/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java b/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java index 4f7bbcc268..eb72924093 100644 --- a/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java +++ b/java/sca/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java @@ -58,10 +58,10 @@ public class AsyncServiceTestCase { Assert.assertEquals(10.0f, sc.getPriceAsyncPoll("foo"));
}
-// @Test
-// public void invokeAsyncCallback() throws Exception {
-// StockQuoteClient sc = node.getService(StockQuoteClient.class, "StockQuoteClient");
-// Assert.assertEquals(10.0f, sc.getPriceAsyncCallback("foo"));
-// }
+ @Test
+ public void invokeAsyncCallback() throws Exception {
+ StockQuoteClient sc = node.getService(StockQuoteClient.class, "StockQuoteClient");
+ Assert.assertEquals(10.0f, sc.getPriceAsyncCallback("foo"));
+ }
}
|