INT-3496: JMX Metrics: Int->Long for All count

JIRA: https://jira.spring.io/browse/INT-3496

**Cherry-pick to 4.0.x & 3.0.x**

INT-3496: revert `int` methods and introduce `long` methods for `count` metrics
This commit is contained in:
Artem Bilan
2014-08-13 14:42:11 +03:00
committed by Gary Russell
parent 248c97098c
commit 59c7c0edc1
20 changed files with 241 additions and 85 deletions

View File

@@ -61,7 +61,9 @@
<constructor-arg>
<array>
<value type="java.lang.String">SendCount</value>
<value type="java.lang.String">SendCountLong</value>
<value type="java.lang.String">SendErrorCount</value>
<value type="java.lang.String">SendErrorCountLong</value>
</array>
</constructor-arg>
</bean>

View File

@@ -25,6 +25,7 @@ import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.endpoint.SourcePollingChannelAdapter;
@@ -104,6 +105,8 @@ public class MBeanAttributeFilterTests {
assertEquals(8, bean.size());
assertFalse(bean.containsKey("SendCount"));
assertFalse(bean.containsKey("SendErrorCount"));
assertFalse(bean.containsKey("SendCountLong"));
assertFalse(bean.containsKey("SendErrorCountLong"));
adapterNot.stop();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@@ -43,7 +43,7 @@ public class ControlBusParserTests {
MessagingTemplate messagingTemplate = new MessagingTemplate();
Object value = messagingTemplate.convertSendAndReceive(control,
"@integrationMbeanExporter.getChannelSendRate('testChannel').count", null);
assertEquals(new Integer(0), value);
assertEquals(0, value);
MBeanExporter exporter = this.context.getBean(MBeanExporter.class);
exporter.destroy();
}

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2009-2010 the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
@@ -36,11 +36,11 @@ public class HandlerMonitoringIntegrationTests {
private Service service;
private IntegrationMBeanExporter messageHandlersMonitor;
public void setMessageHandlersMonitor(IntegrationMBeanExporter messageHandlersMonitor) {
this.messageHandlersMonitor = messageHandlersMonitor;
}
public void setService(Service service) {
this.service = service;
}
@@ -104,7 +104,7 @@ public class HandlerMonitoringIntegrationTests {
void execute(String input) throws Exception;
int getCounter();
}
public static class SimpleService implements Service {
private int counter;
@@ -117,7 +117,7 @@ public class HandlerMonitoringIntegrationTests {
return counter;
}
}
@Aspect
public static class HandlerInterceptor {
@Before("execution(* *..*Tests*(String)) && args(input)")

View File

@@ -91,6 +91,8 @@ public class MessageChannelsMonitorIntegrationTests {
// The handler monitor is registered under the endpoint id (since it is explicit)
int sends = messageChannelsMonitor.getChannelSendRate("" + channel).getCount();
assertEquals("No send statistics for input channel", 50, sends, 0.01);
long sendsLong = messageChannelsMonitor.getChannelSendRate("" + channel).getCountLong();
assertEquals("No send statistics for input channel", sendsLong, sends, 0.01);
}
finally {

View File

@@ -1,15 +1,16 @@
/*
* Copyright 2009-2010 the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package org.springframework.integration.monitor;
import static org.junit.Assert.assertTrue;
@@ -26,11 +27,11 @@ public class MessageSourceMonitoringIntegrationTests {
private Service service;
private IntegrationMBeanExporter exporter;
public void setMessageHandlersMonitor(IntegrationMBeanExporter exporter) {
this.exporter = exporter;
}
public void setService(Service service) {
this.service = service;
}
@@ -78,7 +79,7 @@ public class MessageSourceMonitoringIntegrationTests {
String execute() throws Exception;
int getCounter();
}
public static class SimpleService implements Service {
private int counter;
@@ -92,5 +93,5 @@ public class MessageSourceMonitoringIntegrationTests {
return counter;
}
}
}