*
* @exception JMSException thrown if ping fails
*/
public void pingProvider(String username, String password, int port)
throws JMSException {
QueueConnectionFactory pingQcf;
Connection pingConn;
Properties props;
/*
* Get configuration used to create 'real' admin connections.
*/
props = qcf.getConfiguration();
/*
* Create new connection factory and apply the above configuration
* to it.
*/
pingQcf = new QueueConnectionFactory();
pingQcf.setConnectionType(ClientConstants.CONNECTIONTYPE_ADMIN);
for (Enumeration e = props.propertyNames();
e.hasMoreElements();) {
String propName = (String)e.nextElement();
String value = props.getProperty(propName);
if (value != null) {
pingQcf.setProperty(propName, value);
}
}
/*
* Use specified port in his new connection factory.
*/
pingQcf.setProperty(ConnectionConfiguration.imqBrokerHostPort,
String.valueOf(port));
/*
* Create new connection object using specified username/password.
*/
pingConn = pingQcf.createQueueConnection(username, password);
/*
* Perform ping operation.
*/
pingConn.setExceptionListener(this);