diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-15 16:25:02 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-15 16:25:02 +0000 |
commit | 34ea5dac5d95d94a9acbb4453dfeb097598e63a1 (patch) | |
tree | 5adbaa6619416d6ee8cb8d1e8768fcae485e6785 /sca-java-2.x/trunk/samples/learning-more/async | |
parent | 721f0a86ffa36dea3ddd1b98344c94688c45a2de (diff) |
TUSCANY-3728 Rename the reference async interface and correct the signature of the poll operation which is causing a bind failure in the JIRA.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1022997 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/samples/learning-more/async')
-rw-r--r-- | sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculateReferenceAsync.java (renamed from sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculateViaAsyncRef.java) | 5 | ||||
-rw-r--r-- | sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorClient.java | 4 | ||||
-rw-r--r-- | sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceProxyImpl.java | 18 | ||||
-rw-r--r-- | sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceSync.java (renamed from sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorService.java) | 2 | ||||
-rw-r--r-- | sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceSyncImpl.java | 2 |
5 files changed, 17 insertions, 14 deletions
diff --git a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculateViaAsyncRef.java b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculateReferenceAsync.java index 6ae8fd13f6..c07e5d2d65 100644 --- a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculateViaAsyncRef.java +++ b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculateReferenceAsync.java @@ -22,6 +22,7 @@ package calculator; import java.util.concurrent.Future; import javax.xml.ws.AsyncHandler; +import javax.xml.ws.Response; import org.oasisopen.sca.annotation.Remotable; @@ -31,7 +32,7 @@ import org.oasisopen.sca.annotation.Remotable; */ @Remotable -public interface CalculateViaAsyncRef { +public interface CalculateReferenceAsync { //public Response<String> calculate( Integer i1); @@ -39,7 +40,7 @@ public interface CalculateViaAsyncRef { public String calculate(Integer i1); // Aysnc Poll - public Future<String> calculateAsync(Integer i1); + public Response<String> calculateAsync(Integer i1); // Async Callback public Future<String> calculateAsync(Integer i1, AsyncHandler<String> handler); diff --git a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorClient.java b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorClient.java index cc1d1d8d46..fd7cfcf1e2 100644 --- a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorClient.java +++ b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorClient.java @@ -31,11 +31,11 @@ import org.oasisopen.sca.annotation.Scope; @Scope("COMPOSITE") @EagerInit public class CalculatorClient { - private CalculatorService calculatorService; + private CalculatorServiceSync calculatorService; @Reference - public void setCalculatorService(CalculatorService calculatorService) { + public void setCalculatorService(CalculatorServiceSync calculatorService) { this.calculatorService = calculatorService; } diff --git a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceProxyImpl.java b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceProxyImpl.java index 69c96fe892..f27bf7f7f4 100644 --- a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceProxyImpl.java +++ b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceProxyImpl.java @@ -21,6 +21,8 @@ package calculator; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; +import javax.xml.ws.Response; + import org.oasisopen.sca.annotation.Reference; /** @@ -28,13 +30,13 @@ import org.oasisopen.sca.annotation.Reference; * to sync and asyn versions of the calculator service. This proxy * exercises the various async interface alternatives */ -public class CalculatorServiceProxyImpl implements CalculatorService { +public class CalculatorServiceProxyImpl implements CalculatorServiceSync { @Reference - protected CalculateViaAsyncRef calculatorServiceRefSync; + protected CalculateReferenceAsync calculatorServiceRefSync; @Reference - protected CalculateViaAsyncRef calculatorServiceRefAsync; + protected CalculateReferenceAsync calculatorServiceRefAsync; @Override public String calculate(Integer n1) { @@ -52,21 +54,21 @@ public class CalculatorServiceProxyImpl implements CalculatorService { } // exercise sync and async versions of a service interface method - private String calculate(CalculateViaAsyncRef calculatorRef, Integer n1) { + private String calculate(CalculateReferenceAsync calculatorRef, Integer n1) { // sync String result = calculatorRef.calculate(1); System.out.println("Sync client patern: result = " + result); // async poll - Future<String> future = calculatorRef.calculateAsync(20); + Response<String> response = calculatorRef.calculateAsync(20); - while (!future.isDone()){ + while (!response.isDone()){ System.out.println("Waiting for poll"); } try { - result = future.get(); + result = response.get(); System.out.println("Async client poll patern: result = " + result); } catch (InterruptedException e) { // TODO Auto-generated catch block @@ -78,7 +80,7 @@ public class CalculatorServiceProxyImpl implements CalculatorService { // async callback CalculatorAsyncHandler handler = new CalculatorAsyncHandler(); - future = calculatorRef.calculateAsync(3, handler); + Future<String> future = calculatorRef.calculateAsync(3, handler); while (!future.isDone()){ System.out.println("Waiting for callback"); diff --git a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorService.java b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceSync.java index 45bdd265d4..c0ed1fa798 100644 --- a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorService.java +++ b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceSync.java @@ -25,6 +25,6 @@ import org.oasisopen.sca.annotation.Remotable; */ @Remotable -public interface CalculatorService { +public interface CalculatorServiceSync { String calculate(Integer n1); } diff --git a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceSyncImpl.java b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceSyncImpl.java index 615a4f4f11..a5ab67c086 100644 --- a/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceSyncImpl.java +++ b/sca-java-2.x/trunk/samples/learning-more/async/calculator-contribution/src/main/java/calculator/CalculatorServiceSyncImpl.java @@ -19,7 +19,7 @@ package calculator; -public class CalculatorServiceSyncImpl implements CalculatorService { +public class CalculatorServiceSyncImpl implements CalculatorServiceSync { @Override public String calculate(Integer n1) { |