summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'services/services-engine/src/main/java/org')
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java54
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