- Beautify the format of the connection metadata

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@416598 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-06-23 07:48:01 +00:00
parent 127a36a02b
commit ac86d4d01e
1 changed files with 16 additions and 4 deletions

View File

@ -25,6 +25,7 @@ import javax.jms.Connection;
import javax.jms.Session;
import javax.jms.JMSException;
import javax.jms.Destination;
import java.util.Enumeration;
public abstract class AbstractJmsClient {
private static final Log log = LogFactory.getLog(AbstractJmsClient.class);
@ -79,15 +80,26 @@ public abstract class AbstractJmsClient {
if (jmsConnection == null) {
jmsConnection = factory.createConnection();
getClient().setJmsProvider(jmsConnection.getMetaData().getJMSProviderName() + jmsConnection.getMetaData().getProviderVersion());
// Get Connection Metadata
getClient().setJmsProvider(jmsConnection.getMetaData().getJMSProviderName() + " " + jmsConnection.getMetaData().getProviderVersion());
getClient().setJmsVersion("JMS " + jmsConnection.getMetaData().getJMSVersion());
getClient().setJmsProperties(jmsConnection.getMetaData().getJMSXPropertyNames().toString());
String jmsProperties = "";
Enumeration props = jmsConnection.getMetaData().getJMSXPropertyNames();
while (props.hasMoreElements()) {
jmsProperties += (props.nextElement().toString() + ",");
}
if (jmsProperties.length() > 0) {
// Remove the last comma
jmsProperties = jmsProperties.substring(0, jmsProperties.length()-1);
}
getClient().setJmsProperties(jmsProperties);
}
log.info("Using JMS Connection:" +
" Provider=" + getClient().getJmsProvider() +
" JMS Spec=" + getClient().getJmsVersion() +
" JMS Properties=" + getClient().getJmsProperties());
", JMS Spec=" + getClient().getJmsVersion() +
", JMS Properties=" + getClient().getJmsProperties());
return jmsConnection;
}