@Test public final void testRunShouldntSwitchOnAnythingWhenQueueSizeDidntDropBelowAnyLimit() throws Exception { Whitebox.setInternalState(underTest, "fIDecompressionEnabled", false); Whitebox.setInternalState(underTest, "messageWritingEnabled", false); given(mBeanServerConnection.getAttribute(responseQueue, "QueueSize")).willReturn(new Long(12)); given(mBeanServerConnection.getAttribute(loggerQueue, "QueueSize")).willReturn(new Long(111)); given(mBeanServerConnection.getAttribute(dlqQueue, "QueueSize")).willReturn(new Long(0)); given(mBeanServerConnection.getAttribute(amqObject, "MemoryPercentUsage")).willReturn(new Integer(0)); underTest.run(); verify(logger, never()).info("Due to High load, FI decompression is turned OFF."); verify(logger, never()).info("Due to High load, Message Logging is turned OFF."); verify(logger, never()).info("Due to Normal load, Message Logging is restored."); verify(logger, never()).info("Due to Normal load, FI decompression is restored."); }
@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); }
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); } }
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); }  }
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); }  @Override void run(); }
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); }  @Override void run();  }