public class CalculatorService {
public int add(int a, int b) {
return a + b;
}
}
<destination id="calculatorService">
<properties>
<service-class>com.example.CalculatorService</service-class>
</properties>
</destination>
RemoteObject remoteObj = new RemoteObject();
remoteObj.setDestination("calculatorService");
remoteObj.setSource("calculatorService");
remoteObj.addEventListener(ResultEvent.RESULT, resultHandler);
remoteObj.getOperation("add").send(10, 20);
private void resultHandler(ResultEvent event) {
int result = (int) event.getReponse();
System.out.println("Result: " + result);
}