diff options
author | liamfallon <liam.fallon@est.tech> | 2020-04-01 09:38:33 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2020-04-02 16:33:47 +0100 |
commit | 30f94aa98ebc8931e224cdd2e5b8c25949379065 (patch) | |
tree | fe1391f867cd11726da9dfcf6b6089dd74f4c3ef /services/services-engine/src | |
parent | 42cd61abcc9cd27e72eaa34a746ee176dbf30750 (diff) |
Fix hanging timeout on Executor test
Issue-ID: POLICY-2106
Change-Id: I7bd44f8dfe349d73a4c8c4f978a30b455c45b2c7
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'services/services-engine/src')
-rw-r--r-- | services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java index 8708e97e6..2c1c900c8 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { * @param consumerParameters the consumer parameters for this specific unmarshaler */ public ApexEventUnmarshaller(final String name, final EngineServiceParameters engineServiceParameters, - final EventHandlerParameters consumerParameters) { + final EventHandlerParameters consumerParameters) { this.name = name; this.engineServiceParameters = engineServiceParameters; this.consumerParameters = consumerParameters; @@ -123,7 +123,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { // Configure and start the event reception thread final String threadName = - engineServiceParameters.getEngineKey().getName() + ":" + this.getClass().getName() + ":" + name; + engineServiceParameters.getEngineKey().getName() + ":" + this.getClass().getName() + ":" + name; unmarshallerThread = new ApplicationThreadFactory(threadName).newThread(this); unmarshallerThread.setDaemon(true); unmarshallerThread.start(); @@ -168,7 +168,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { // To connect a synchronous unmarshaler and marshaler, we create a synchronous event // cache on the consumer/producer pair new SynchronousEventCache(peeredMode, consumer, peeredMarshaller.getProducer(), - consumerParameters.getPeerTimeout(EventHandlerPeeredMode.SYNCHRONOUS)); + consumerParameters.getPeerTimeout(EventHandlerPeeredMode.SYNCHRONOUS)); return; case REQUESTOR: @@ -185,7 +185,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { */ @Override public void receiveEvent(@NonNull final Properties executionProperties, final Object event) - throws ApexEventException { + throws ApexEventException { receiveEvent(0, executionProperties, event, true); } @@ -194,7 +194,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { */ @Override public void receiveEvent(final long executionId, @NonNull final Properties executionProperties, final Object event) - throws ApexEventException { + throws ApexEventException { receiveEvent(executionId, executionProperties, event, false); } @@ -208,7 +208,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { * @throws ApexEventException on unmarshaling errors on events */ private void receiveEvent(final long executionId, final Properties executionProperties, final Object event, - final boolean generateExecutionId) throws ApexEventException { + final boolean generateExecutionId) throws ApexEventException { // Push the event onto the queue if (LOGGER.isTraceEnabled()) { String eventString = "onMessage(): event received: " + event.toString(); @@ -234,19 +234,19 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { apexEvent.setExecutionProperties(executionProperties); - // Enqueue the event - queue.add(apexEvent); - // Cache synchronized events that are sent if (consumerParameters.isPeeredMode(EventHandlerPeeredMode.SYNCHRONOUS)) { final SynchronousEventCache synchronousEventCache = - (SynchronousEventCache) consumer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS); + (SynchronousEventCache) consumer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS); synchronousEventCache.cacheSynchronizedEventToApex(apexEvent.getExecutionId(), apexEvent); } + + // Enqueue the event + queue.add(apexEvent); } } catch (final ApexException e) { final String errorMessage = "Error while converting event into an ApexEvent for " + name + ": " - + e.getMessage() + ", Event=" + event; + + e.getMessage() + ", Event=" + event; LOGGER.warn(errorMessage, e); throw new ApexEventException(errorMessage, e); } @@ -261,11 +261,11 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { // Check if we are filtering events on this unmarshaler, if so check the event name // against the filter if (consumerParameters.isSetEventNameFilter() - && !apexEvent.getName().matches(consumerParameters.getEventNameFilter())) { + && !apexEvent.getName().matches(consumerParameters.getEventNameFilter())) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("onMessage(): event {} not processed, filtered out by filter", apexEvent, - consumerParameters.getEventNameFilter()); + consumerParameters.getEventNameFilter()); } return true; @@ -330,7 +330,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { // Order a stop on the synchronous cache if one exists if (consumerParameters != null && consumerParameters.isPeeredMode(EventHandlerPeeredMode.SYNCHRONOUS) - && consumer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS) != null) { + && consumer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS) != null) { ((SynchronousEventCache) consumer.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS)).stop(); } |