use of org.jowidgets.service.api.IServiceProvider in project jo-client-platform by jo-source.
the class RemotingServiceInitializer method initialize.
/**
* Initializes the remoting services.
* This method blocks until the remoting services are initialized, the invocation was canceled or the timeout elapsed
*
* @param timeout The timeout
* @param cancelCallback Can be used to cancel the initialization
*
* @return True if the remoting services was initialized, false otherwise (e.g. timeout occured)
*/
public synchronized boolean initialize(final long timeout, final ICancelCallback cancelCallback) {
if (!initialized.get()) {
final IServiceProvider serviceProvider;
try {
serviceProvider = RemotingServiceProviderFactory.create(brokerId, timeout, cancelCallback);
ServiceProvider.registerServiceProviderHolder(new DefaultServiceProviderHolder(serviceProvider));
initialized.set(true);
} catch (final RemotingTimeoutException e) {
// do nothing, because this method returns false then
} catch (final ServiceCanceledException e) {
// do nothing, because this method returns false then
}
}
return initialized.get();
}
Aggregations