diff options
author | Jorge Hernandez <jorge.hernandez-herrero@att.com> | 2018-12-03 19:41:57 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-03 19:41:57 +0000 |
commit | dc2e6900325c0e69e7efb0346602d29ee634fbea (patch) | |
tree | 02863f8340b35aa5f1aeb36a9083026c4e8cf2b9 /services/services-engine | |
parent | a3532f2fd160f1751162d27caae65414afa9c30c (diff) | |
parent | 9104eb39d56848952e68d660bdc3cc7500789501 (diff) |
Merge "Fix checkstyle/sonar issues"
Diffstat (limited to 'services/services-engine')
-rw-r--r-- | services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java index c39be64fc..08c0e6910 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java @@ -127,30 +127,7 @@ public class ApexActivator { unmarshaller.init(engineServiceHandler); } - // Set up unmarshaler/marshaler pairing for synchronized event handling. We only need to - // traverse the unmarshalers because the - // unmarshalers and marshalers are paired one to one uniquely so if we find a - // synchronized unmarshaler we'll also find its - // paired marshaler - for (final Entry<String, EventHandlerParameters> inputParameters : apexParameters.getEventInputParameters() - .entrySet()) { - final ApexEventUnmarshaller unmarshaller = unmarshallerMap.get(inputParameters.getKey()); - - // Pair up peered unmarshalers and marshalers - for (final EventHandlerPeeredMode peeredMode : EventHandlerPeeredMode.values()) { - // Check if the unmarshaler is synchronized with a marshaler - if (inputParameters.getValue().isPeeredMode(peeredMode)) { - // Find the unmarshaler and marshaler - final ApexEventMarshaller peeredMarshaler = - marshallerMap.get(inputParameters.getValue().getPeer(peeredMode)); - - // Connect the unmarshaler and marshaler - unmarshaller.connectMarshaler(peeredMode, peeredMarshaler); - } - } - // Now let's get events flowing - unmarshaller.start(); - } + setUpmarshalerPairings(); } catch (final Exception e) { LOGGER.debug("Apex engine failed to start as a service", e); throw new ApexActivatorException("Apex engine failed to start as a service", e); @@ -160,6 +137,35 @@ public class ApexActivator { } /** + * Set up unmarshaler/marshaler pairing for synchronized event handling. We only need to + * traverse the unmarshalers because the + * unmarshalers and marshalers are paired one to one uniquely so if we find a + * synchronized unmarshaler we'll also find its + * paired marshaler + */ + private void setUpmarshalerPairings() { + for (final Entry<String, EventHandlerParameters> inputParameters : apexParameters.getEventInputParameters() + .entrySet()) { + final ApexEventUnmarshaller unmarshaller = unmarshallerMap.get(inputParameters.getKey()); + + // Pair up peered unmarshalers and marshalers + for (final EventHandlerPeeredMode peeredMode : EventHandlerPeeredMode.values()) { + // Check if the unmarshaler is synchronized with a marshaler + if (inputParameters.getValue().isPeeredMode(peeredMode)) { + // Find the unmarshaler and marshaler + final ApexEventMarshaller peeredMarshaler = + marshallerMap.get(inputParameters.getValue().getPeer(peeredMode)); + + // Connect the unmarshaler and marshaler + unmarshaller.connectMarshaler(peeredMode, peeredMarshaler); + } + } + // Now let's get events flowing + unmarshaller.start(); + } + } + + /** * Terminate the Apex engine. * * @throws ApexException on termination errors |