Source:
public ManagementAgentService(final ManagementAgentEntity entity) { this.clientIdentifier = get(entity.getClientIdentifier(null), 20000); this.entity = Objects.requireNonNull(entity); this.entity.registerListener(new MessageListener<ManagementCallMessage>() { @Override public void onMessage(final ManagementCallMessage message) { if (message.getType().equals("MANAGEMENT_CALL")) { final ContextualCall contextualCall = message.unwrap(ContextualCall.class).get(0); managementCallExecutor.execute(new Runnable() { @Override public void run() { try { if (bridging) { ContextualReturn<?> aReturn = registry.withCapability(contextualCall.getCapability()) .call(contextualCall.getMethodName(), contextualCall.getReturnType(), contextualCall.getParameters()) .on(contextualCall.getContext()) .build() .execute() .getSingleResult(); if (bridging) { get(entity.callReturn(null, message.getFrom(), message.getManagementCallIdentifier(), aReturn), timeout); } } } catch (RuntimeException err) { LOGGER.log(Level.WARNING, "Error on management call execution or result sending for " + contextualCall + ". Error: " + err.getMessage(), err); } } }); } else if (message.getType().equals("MANAGEMENT_CALL_RETURN")) { final ContextualReturn<?> aReturn = message.unwrap(ContextualReturn.class).get(0); managementCallExecutor.execute(new Runnable() { @Override public void run() { try { contextualReturnListener.onContextualReturn(message.getFrom(), message.getManagementCallIdentifier(), aReturn); } catch (RuntimeException err) { LOGGER.log(Level.WARNING, "Error on management call result listener for " + message + ". Error: " + err.getMessage(), err); } } }); } } }); }

Target:
public ManagementAgentService(final ManagementAgentEntity entity) { this.clientIdentifier = get(entity.getClientIdentifier(null), 20000); this.entity = Objects.requireNonNull(entity); this.entity.registerListener(new MessageListener<ManagementCallMessage>() { @Override public void onMessage(final ManagementCallMessage message) { if (message.getType().equals("MANAGEMENT_CALL")) { final ContextualCall contextualCall = message.unwrap(ContextualCall.class).get(0); managementCallExecutor.execute(new Runnable() { @Override public void run() { try { if (bridging) { ContextualReturn<?> aReturn = registry.withCapability(contextualCall.getCapability()) .call(contextualCall.getMethodName(), contextualCall.getReturnType(), contextualCall.getParameters()) .on(contextualCall.getContext()) .build() .execute() .getSingleResult(); if (bridging) { get(entity.callReturn(null, message.getFrom(), message.getManagementCallIdentifier(), aReturn), timeout); } } } catch (RuntimeException err) { if(LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "Error on management call execution or result sending for " + contextualCall + ". Error: " + err.getMessage(), err); } } } }); } else if (message.getType().equals("MANAGEMENT_CALL_RETURN")) { final ContextualReturn<?> aReturn = message.unwrap(ContextualReturn.class).get(0); managementCallExecutor.execute(new Runnable() { @Override public void run() { try { contextualReturnListener.onContextualReturn(message.getFrom(), message.getManagementCallIdentifier(), aReturn); } catch (RuntimeException err) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "Error on management call result listener for " + message + ". Error: " + err.getMessage(), err); } } } }); } } }); }