mirror of https://github.com/apache/activemq.git
Fix the setting of the connection metadata
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@417391 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b1d2279145
commit
ffcbd0c015
|
@ -79,27 +79,8 @@ public abstract class AbstractJmsClient {
|
|||
public Connection getConnection() throws JMSException {
|
||||
if (jmsConnection == null) {
|
||||
jmsConnection = factory.createConnection();
|
||||
|
||||
// Get Connection Metadata
|
||||
getClient().setJmsProvider(jmsConnection.getMetaData().getJMSProviderName() + " " + jmsConnection.getMetaData().getProviderVersion());
|
||||
getClient().setJmsVersion("JMS " + jmsConnection.getMetaData().getJMSVersion());
|
||||
|
||||
String jmsProperties = "";
|
||||
Enumeration props = jmsConnection.getMetaData().getJMSXPropertyNames();
|
||||
while (props.hasMoreElements()) {
|
||||
jmsProperties += (props.nextElement().toString() + ",");
|
||||
log.info("Creating JMS Connection: Provider=" + getClient().getJmsProvider() + ", JMS Spec=" + getClient().getJmsVersion());
|
||||
}
|
||||
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());
|
||||
return jmsConnection;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@ import org.apache.activemq.tool.spi.SPIConnectionFactory;
|
|||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.ConnectionMetaData;
|
||||
import java.util.Properties;
|
||||
import java.util.Enumeration;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class AbstractJmsClientSystem extends AbstractObjectProperties {
|
||||
|
@ -52,6 +54,8 @@ public abstract class AbstractJmsClientSystem extends AbstractObjectProperties {
|
|||
// Create connection factory
|
||||
jmsConnFactory = loadJmsFactory(getSysTest().getSpiClass(), factory.getFactorySettings());
|
||||
|
||||
setProviderMetaData(jmsConnFactory.createConnection().getMetaData(), getJmsClientProperties());
|
||||
|
||||
// Create performance sampler
|
||||
PerformanceReportWriter writer = createPerfWriter();
|
||||
tpSampler.setPerfReportWriter(writer);
|
||||
|
@ -206,5 +210,21 @@ public abstract class AbstractJmsClientSystem extends AbstractObjectProperties {
|
|||
}
|
||||
}
|
||||
|
||||
protected void setProviderMetaData(ConnectionMetaData metaData, JmsClientProperties props) throws JMSException {
|
||||
props.setJmsProvider(metaData.getJMSProviderName() + "-" + metaData.getProviderVersion());
|
||||
props.setJmsVersion(metaData.getJMSVersion());
|
||||
|
||||
String jmsProperties = "";
|
||||
Enumeration jmsProps = metaData.getJMSXPropertyNames();
|
||||
while (jmsProps.hasMoreElements()) {
|
||||
jmsProperties += (jmsProps.nextElement().toString() + ",");
|
||||
}
|
||||
if (jmsProperties.length() > 0) {
|
||||
// Remove the last comma
|
||||
jmsProperties = jmsProperties.substring(0, jmsProperties.length()-1);
|
||||
}
|
||||
props.setJmsProperties(jmsProperties);
|
||||
}
|
||||
|
||||
protected abstract void runJmsClient(String clientName, int clientDestIndex, int clientDestCount);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.StringTokenizer;
|
|||
import java.util.Properties;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Arrays;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Field;
|
||||
|
|
Loading…
Reference in New Issue