diff options
author | ramverma <ram.krishna.verma@ericsson.com> | 2018-07-02 17:03:37 +0100 |
---|---|---|
committer | ramverma <ram.krishna.verma@ericsson.com> | 2018-07-02 17:04:19 +0100 |
commit | bf49cf5d70526ee96ac19c3cd3f0cfc38fb372ae (patch) | |
tree | 1f77a02ce20c37aa09509d9a57c967a696a8f8ad /plugins/plugins-event | |
parent | f635690cef7f59a6515322443e6129c2444e55ab (diff) |
Fix the apex-pdp build issue
Change-Id: I50532314948d16432065dacbadb9d69d8ca49084
Issue-ID: POLICY-865
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'plugins/plugins-event')
-rw-r--r-- | plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJMSConsumer.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJMSConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJMSConsumer.java index a96517510..878882d6b 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJMSConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJMSConsumer.java @@ -196,7 +196,7 @@ public class ApexJMSConsumer implements MessageListener, ApexEventConsumer, Runn @Override public void run() { // JMS session and message consumer for receiving messages - try (Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) { + try (final Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) { // Create a message consumer for reception of messages and set this class as a message listener createMessageConsumer(jmsSession); } catch (final Exception e) { @@ -209,20 +209,21 @@ public class ApexJMSConsumer implements MessageListener, ApexEventConsumer, Runn LOGGER.debug("event receiver " + this.getClass().getName() + ":" + this.name + " subscribed to JMS topic: " + jmsConsumerProperties.getConsumerTopic()); } - // The endless loop that receives events over JMS - while (consumerThread.isAlive() && !stopOrderedFlag) { - ThreadUtilities.sleep(jmsConsumerProperties.getConsumerWaitTime()); - } } /** * The helper function to create a message consumer from a given JMS session - * + * * @param jmsSession a JMS session */ - private void createMessageConsumer(Session jmsSession) { - try (MessageConsumer messageConsumer = jmsSession.createConsumer(jmsIncomingTopic)) { + private void createMessageConsumer(final Session jmsSession) { + try (final MessageConsumer messageConsumer = jmsSession.createConsumer(jmsIncomingTopic)) { messageConsumer.setMessageListener(this); + + // The endless loop that receives events over JMS + while (consumerThread.isAlive() && !stopOrderedFlag) { + ThreadUtilities.sleep(jmsConsumerProperties.getConsumerWaitTime()); + } } catch (final Exception e) { final String errorMessage = "failed to create a JMS message consumer for receiving messages"; LOGGER.warn(errorMessage, e); |