}
public synchronized Map getStatistics(DestinationConfig dConfig) throws JMSException
{
final Map stats = new LinkedHashMap();
MQQueue queue = null ;
try
{
final String queueName = getRealDestinationName(dConfig);
queue = getQueueManager().accessQueue(queueName, MQC.MQOO_INQUIRE | MQC.MQOO_INPUT_AS_Q_DEF, null, null, null);
stats.put("Description", queue.getDescription().trim());
stats.put("CurrentDepth", new Integer(queue.getCurrentDepth()));
stats.put("OpenOutputCount", new Integer(queue.getOpenOutputCount()));
stats.put("OpenInputCount", new Integer(queue.getOpenInputCount()));
if (queue.getInhibitGet() == MQC.MQQA_GET_INHIBITED)
{
stats.put("InhibitGet", Boolean.TRUE);
}
else
{
stats.put("InhibitGet", Boolean.FALSE);
}
if (queue.getInhibitPut() == MQC.MQQA_PUT_INHIBITED)
{
stats.put("InhibitPut", Boolean.TRUE);
}
else
{
stats.put("InhibitPut", Boolean.FALSE);
}
if (queue.getShareability() == MQC.MQQA_SHAREABLE)
{
stats.put("Sharable", Boolean.TRUE);
}
else
{
stats.put("Sharable", Boolean.FALSE);
}
if (queue.getTriggerControl() == MQC.MQTC_ON)
{
stats.put("TriggerControl", Boolean.TRUE);
stats.put("TriggerData", queue.getTriggerData());
stats.put("TriggerDepth", new Integer(queue.getTriggerDepth()));
stats.put("TriggerMessagePriority", new Integer(queue.getTriggerMessagePriority()));
switch (queue.getTriggerType())
{
case MQC.MQTT_NONE:
stats.put("TriggerType", "None");
break;
case MQC.MQTT_DEPTH:
stats.put("TriggerType", "Depth");
break;
case MQC.MQTT_EVERY:
stats.put("TriggerType", "Every");
break;
case MQC.MQTT_FIRST:
stats.put("TriggerType", "First");
break;
default:
stats.put("TriggerType", "Unknown");
}
}
else
{
stats.put("TriggerControl", Boolean.FALSE);
}
stats.put("MaximumDepth", new Integer(queue.getMaximumDepth()));
stats.put("MaximumMessageLength", new Integer(queue.getMaximumMessageLength()));
}
catch (MQException ex)
{
if (ex.reasonCode != 2033)
{
throw new HermesException(ex) ;
}
else
{
log.debug("PCF calls gave a 2033 reason code, ignoring") ;
}
}
catch (Exception ex) {
throw new HermesException(ex) ;
}
finally
{
if (queue != null)
{
try
{
queue.close() ;
}
catch (MQException ex)
{
log.error("ignoring error closing queue: " + ex.getMessage(), ex) ;
}