From 88a1b709b12205684cc1711cbc186ca5409a6ab8 Mon Sep 17 00:00:00 2001 From: trifonnt Date: Thu, 24 Sep 2009 10:05:25 +0000 Subject: [PATCH] BF [2865590] - Replication: opening connections https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2865590&group_id=176962 Patch [2865593] - BR:2865590 Replication: opening connections https://sourceforge.net/tracker/?func=detail&aid=2865593&group_id=176962&atid=879334 Thank's to Colin! --- .../server/rpl/imp/TopicListener.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicListener.java b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicListener.java index 2ab1e01253..e4d006153a 100644 --- a/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicListener.java +++ b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicListener.java @@ -191,15 +191,14 @@ public class TopicListener implements MessageListener { ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory( url ); log.finest("ActiveMQConnectionFactory = " + factory); - if (userName !=null && password != null) { + if (userName !=null && password !=null) { conn = factory.createConnection(userName, password); } else { conn = factory.createConnection(); } - log.finest("conn = " + conn ); - if(conn.getClientID()==null) + if (conn.getClientID()==null) { try { @@ -208,17 +207,27 @@ public class TopicListener implements MessageListener { catch (Exception e) { log.info("Connection with clientID '" + clientID +"' already exists"); + conn.close(); return; } - }else - { - if(conn.getClientID().equals(clientID)) + } else { + if (conn.getClientID().equals(clientID)) { - log.warning("Connection with clientID '" + clientID - + "' already exists"); + log.warning("Connection with clientID '" + clientID + "' already exists"); + conn.close(); return; - }else - conn.setClientID( clientID ); + } else { + try + { + conn.setClientID( clientID ); + } + catch (Exception e) + { + log.info("Error while invoking setClientID(" + clientID +")! " + e.getMessage()); + conn.close(); + return; + } + } } @@ -254,7 +263,6 @@ public class TopicListener implements MessageListener { pLog.setReference( logReference.toString() ); boolean resultSave = pLog.save(); log.finest("Result Save = " + resultSave); - } /** @@ -302,7 +310,6 @@ public class TopicListener implements MessageListener { } else { log.finest("Received NO TEXT Message: " ); - // Received non text message!!! } }