class JmsQueueMonitorTask implements Runnable {

    @Override
    public void run() {
        getSafeguardLimits();

        String jmxServiceUrl = JMX_SERVICE_PRE_URL + safeguardLimits.getJmxPort() + JMX_SERVICE_POST_URL;

        if (mBeanServerConnection == null || responseQueue == null || loggerQueue == null || dlqQueue == null || amqObject == null) {
            mBeanServerConnection = jmxConnectionBuilder.buildMBeanServerConnection(jmxServiceUrl);
            responseQueue = jmxObjectNameProvider.getObjectName(RESPONSE_QUEUE_OBJECT_NAME);
            loggerQueue = jmxObjectNameProvider.getObjectName(LOGGER_QUEUE_OBJECT_NAME);
            dlqQueue = jmxObjectNameProvider.getObjectName(DLQ_QUEUE_OBJECT_NAME);
            amqObject = jmxObjectNameProvider.getObjectName(AMQ_OBJECT_NAME);
        }

        Long totalQueueSize = retrieveQuerySize();

        setSafeguardFlags(totalQueueSize);

        resetDlqAsNecessary();
        resetAMQueueAsNecessary(totalQueueSize);
    }

}