use of org.jowidgets.invocation.service.common.api.IInterimResponseCallback in project jo-client-platform by jo-source.
the class InvocationServiceClientImpl method getMethodService.
@Override
public <RES, INT_RES, REQ, RESP, PARAM> IMethodInvocationService<RES, INT_RES, REQ, RESP, PARAM> getMethodService(final String methodName, final long timeout) {
Assert.paramNotNull(methodName, "methodName");
return new IMethodInvocationService<RES, INT_RES, REQ, RESP, PARAM>() {
@Override
public void invoke(final IInvocationCallback<RES> invocationCallback, final IInterimResponseCallback<INT_RES> interimResponseCallback, final IInterimRequestCallback<REQ, RESP> interimRequestCallback, final PARAM parameter) {
final IMethod method = invocationClient.getMethod(methodName);
if (method == null) {
throw new IllegalArgumentException("No server method registered for method name '" + methodName + "'.");
} else {
final Object invocationId = invocationCallbackService.registerInvocation(invocationCallback, interimResponseCallback, interimRequestCallback, timeout, invocationClient);
method.invoke(invocationId, parameter);
}
}
};
}
Aggregations