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!
This commit is contained in:
trifonnt 2009-09-24 10:05:25 +00:00
parent 304843ba46
commit 88a1b709b1
1 changed files with 19 additions and 12 deletions

View File

@ -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!!!
}
}