summaryrefslogtreecommitdiffstats
path: root/contrib/samples/async/sample-contribution-implementation-java-calculator-async/src/main/java/calculator/CalculateViaAsyncRefImpl.java
blob: 589bcab35f6d7d97e47bcb0715f100186afbd804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package calculator;

import java.util.concurrent.ExecutionException;

import javax.xml.ws.Response;

import org.oasisopen.sca.annotation.Reference;

public class CalculateViaAsyncRefImpl implements CalculatorService {

	@Reference CalculateViaAsyncRef calculatorRef = null;

	@Override
	public String calculate(Integer n1) {
		Response<String> r = calculatorRef.calculate(n1);
		String result=null;
		try {
			result = r.get();
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (ExecutionException e) {
			e.printStackTrace();
		}
		return result;
	}
}