Search in sources :

Example 76 with JoynrRuntimeException

use of io.joynr.exceptions.JoynrRuntimeException in project joynr by bmwcarit.

the class LocalCapabilitiesDirectoryImpl method registerGlobal.

private void registerGlobal(final DiscoveryEntry discoveryEntry, final DeferredVoid deferred) {
    synchronized (globalAddressLock) {
        try {
            globalAddress = globalAddressProvider.get();
        } catch (Exception e) {
            logger.debug("error getting global address", e);
            globalAddress = null;
        }
        if (globalAddress == null) {
            queuedDiscoveryEntries.add(new QueuedDiscoveryEntry(discoveryEntry, deferred));
            globalAddressProvider.registerGlobalAddressesReadyListener(this);
            return;
        }
    }
    final GlobalDiscoveryEntry globalDiscoveryEntry = CapabilityUtils.discoveryEntry2GlobalDiscoveryEntry(discoveryEntry, globalAddress);
    if (globalDiscoveryEntry != null) {
        logger.info("starting global registration for " + globalDiscoveryEntry.getDomain() + " : " + globalDiscoveryEntry.getInterfaceName());
        globalCapabilitiesDirectoryClient.add(new Callback<Void>() {

            @Override
            public void onSuccess(Void nothing) {
                logger.info("global registration for " + globalDiscoveryEntry.getDomain() + " : " + globalDiscoveryEntry.getInterfaceName() + " completed");
                deferred.resolve();
                globalDiscoveryEntryCache.add(CapabilityUtils.discoveryEntry2GlobalDiscoveryEntry(discoveryEntry, globalAddress));
            }

            @Override
            public void onFailure(JoynrRuntimeException exception) {
                deferred.reject(new ProviderRuntimeException(exception.toString()));
            }
        }, globalDiscoveryEntry);
    }
}
Also used : GlobalDiscoveryEntry(joynr.types.GlobalDiscoveryEntry) DeferredVoid(io.joynr.provider.DeferredVoid) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) DiscoveryException(io.joynr.exceptions.DiscoveryException) ApplicationException(joynr.exceptions.ApplicationException) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException) JoynrRuntimeException(io.joynr.exceptions.JoynrRuntimeException) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Aggregations

JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)76 Test (org.junit.Test)41 ApplicationException (joynr.exceptions.ApplicationException)18 joynr.tests.testProxy (joynr.tests.testProxy)16 MessagingQos (io.joynr.messaging.MessagingQos)14 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)13 Callback (io.joynr.proxy.Callback)9 Future (io.joynr.proxy.Future)9 ProviderRuntimeException (joynr.exceptions.ProviderRuntimeException)9 IOException (java.io.IOException)8 Semaphore (java.util.concurrent.Semaphore)8 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)8 InvocationOnMock (org.mockito.invocation.InvocationOnMock)8 DiscoveryException (io.joynr.exceptions.DiscoveryException)7 JoynrException (io.joynr.exceptions.JoynrException)7 DeferredVoid (io.joynr.provider.DeferredVoid)7 HashSet (java.util.HashSet)7 ProviderQos (joynr.types.ProviderQos)7 JoynrIllegalStateException (io.joynr.exceptions.JoynrIllegalStateException)5 ProxyCreatedCallback (io.joynr.proxy.ProxyBuilder.ProxyCreatedCallback)5