use of org.jowidgets.service.tools.ServiceProviderBuilder in project jo-client-platform by jo-source.
the class RemotingServiceProviderFactory method create.
/**
* Creates the service provider for the remote services defined by the broker id
*
* @param brokerId The broker id to get the remote services for
* @param timeout The timeout after giving up, e.g. if server is not available
* @param cancelCallback A cancel callback that can be used to cancel the creation
*
* @return The ServiceProvider
*
* @throws RemotingTimeoutException if the timeout elapsed before initialization
*/
public static IServiceProvider create(final Object brokerId, final long timeout, final ICancelCallback cancelCallback) {
final ServiceProviderBuilder builder = new ServiceProviderBuilder();
final IInvocationServiceClient invocationServiceClient = InvocationServiceClientToolkit.getClient(brokerId);
final IMethodInvocationService<Set<? extends IServiceId<?>>, Void, Void, Void, Void> methodService;
methodService = invocationServiceClient.getMethodService(CapInvocationMethodNames.SERVICE_LOCATOR_METHOD_NAME);
final SyncInvocationCallback<Set<? extends IServiceId<?>>> invocationCallback;
invocationCallback = new SyncInvocationCallback<Set<? extends IServiceId<?>>>(getExecutionCallback(cancelCallback), timeout);
methodService.invoke(invocationCallback, null, null, null);
addServices(builder, brokerId, invocationCallback.getResultSynchronious());
return builder.build();
}
Aggregations