[ 2194986 ] Already connected ClientID issue.
http://sourceforge.net/tracker/index.php?func=detail&aid=2194986&group_id=176962&atid=879332
This commit is contained in:
parent
2be32a8b88
commit
821ae5d8b6
|
@ -22,10 +22,12 @@
|
||||||
* *
|
* *
|
||||||
* Contributors: *
|
* Contributors: *
|
||||||
* - Trifon Trifonov (trifonnt@users.sourceforge.net) *
|
* - Trifon Trifonov (trifonnt@users.sourceforge.net) *
|
||||||
|
* - Antonio Cañaveral (antonio.canaveral@e-evolution.com)
|
||||||
* *
|
* *
|
||||||
* Sponsors: *
|
* Sponsors: *
|
||||||
* - E-evolution (http://www.e-evolution.com/) *
|
* - E-evolution (http://www.e-evolution.com/) *
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
package org.adempiere.server.rpl.imp;
|
package org.adempiere.server.rpl.imp;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -50,6 +52,9 @@ import org.w3c.dom.Document;
|
||||||
/**
|
/**
|
||||||
* Listen for JMS Messages
|
* Listen for JMS Messages
|
||||||
* @author Trifon N. Trifonov
|
* @author Trifon N. Trifonov
|
||||||
|
* @author Antonio Cañaveral, e-Evolution
|
||||||
|
* <li>[ 2194986 ] Already connected ClientID issue.
|
||||||
|
* <li>http://sourceforge.net/tracker/index.php?func=detail&aid=2194986&group_id=176962&atid=879332
|
||||||
*/
|
*/
|
||||||
public class TopicListener implements MessageListener {
|
public class TopicListener implements MessageListener {
|
||||||
|
|
||||||
|
@ -156,7 +161,14 @@ public class TopicListener implements MessageListener {
|
||||||
|
|
||||||
this.topicName = topicName;
|
this.topicName = topicName;
|
||||||
|
|
||||||
this.setUrl(this.protocol + "://" + this.host + ":" + this.port);
|
String uri=this.protocol + "://" + this.host + ":" + this.port;
|
||||||
|
|
||||||
|
if(options!=null && options.length()>0)
|
||||||
|
{
|
||||||
|
if(!options.contains("?"))
|
||||||
|
uri+="?"+options;
|
||||||
|
}
|
||||||
|
this.setUrl(uri);
|
||||||
|
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
|
|
||||||
|
@ -188,17 +200,22 @@ public class TopicListener implements MessageListener {
|
||||||
|
|
||||||
log.finest("conn = " + conn );
|
log.finest("conn = " + conn );
|
||||||
|
|
||||||
try {
|
if(conn.getClientID()==null)
|
||||||
conn.setClientID( clientID );
|
{
|
||||||
} catch (InvalidClientIDException e) {
|
conn.setClientID( clientID );
|
||||||
// TODO find a better way to check whether the connection already
|
}else
|
||||||
// exists
|
{
|
||||||
log.config("Connection with clientID '" + clientID
|
if(conn.getClientID().equals(clientID))
|
||||||
+ "' already exists");
|
{
|
||||||
return;
|
log.config("Connection with clientID '" + clientID
|
||||||
|
+ "' already exists");
|
||||||
|
return;
|
||||||
|
}else
|
||||||
|
conn.setClientID( clientID );
|
||||||
}
|
}
|
||||||
|
|
||||||
session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); // TODO - could be parameter
|
|
||||||
|
session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE); // TODO - could be parameter
|
||||||
log.finest("session = " + session );
|
log.finest("session = " + session );
|
||||||
|
|
||||||
log.finest("topicName = " + topicName );
|
log.finest("topicName = " + topicName );
|
||||||
|
@ -263,9 +280,15 @@ public class TopicListener implements MessageListener {
|
||||||
boolean resultSave = pLog.save();
|
boolean resultSave = pLog.save();
|
||||||
log.finest("Result Save = " + resultSave);
|
log.finest("Result Save = " + resultSave);
|
||||||
|
|
||||||
|
session.commit();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
replicationProcessor.setProcessRunning(false);
|
replicationProcessor.setProcessRunning(false);
|
||||||
|
try {
|
||||||
|
session.rollback();
|
||||||
|
} catch (JMSException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue