提交 882668da 编写于 作者: W william.liangf

DUBBO-379 将count改为了collect,并通过参数URL的协议区分数据

git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1725 1a56cb94-b969-4eaa-88fa-be21384802f2
上级 3d2836f7
......@@ -61,10 +61,10 @@ public interface MonitorService {
String MAX_CONCURRENT = "max.concurrent";
/**
* count.
* collect.
*
* @param statistics
*/
void count(URL statistics);
void collect(URL statistics);
}
\ No newline at end of file
......@@ -100,7 +100,7 @@ public class MonitorFilter implements Filter {
remoteKey = MonitorService.CONSUMER;
remoteValue = context.getRemoteHost();
}
monitor.count(new URL(Constants.COUNT_PROTOCOL,
monitor.collect(new URL(Constants.COUNT_PROTOCOL,
NetUtils.getLocalHost(), localPort,
service + "/" + method,
MonitorService.APPLICATION, application,
......
......@@ -80,7 +80,7 @@ public class MonitorFilterTest {
}
public void destroy() {
}
public void count(URL statistics) {
public void collect(URL statistics) {
MonitorFilterTest.this.lastStatistics = statistics;
}
};
......
......@@ -109,7 +109,7 @@ public class DubboMonitor implements Monitor {
MonitorService.MAX_ELAPSED, String.valueOf(maxElapsed),
MonitorService.MAX_CONCURRENT, String.valueOf(maxConcurrent)
);
monitorService.count(url);
monitorService.collect(url);
// 减掉已统计数据
long[] current;
......@@ -135,7 +135,7 @@ public class DubboMonitor implements Monitor {
}
}
public void count(URL url) {
public void collect(URL url) {
// 读写统计变量
int success = url.getParameter(MonitorService.SUCCESS, 0);
int failure = url.getParameter(MonitorService.FAILURE, 0);
......
......@@ -60,7 +60,7 @@ public class DubboMonitorTest {
private final MonitorService monitorService = new MonitorService() {
public void count(URL statistics) {
public void collect(URL statistics) {
DubboMonitorTest.this.lastStatistics = statistics;
}
......@@ -80,7 +80,7 @@ public class DubboMonitorTest {
.addParameter(MonitorService.MAX_ELAPSED, 3)
.addParameter(MonitorService.CONCURRENT, 1)
.addParameter(MonitorService.MAX_CONCURRENT, 1);
monitor.count(statistics);
monitor.collect(statistics);
while (lastStatistics == null) {
Thread.sleep(10);
}
......@@ -123,7 +123,7 @@ public class DubboMonitorTest {
try {
Monitor monitor = monitorFactory.getMonitor(URL.valueOf("dubbo://127.0.0.1:17979?interval=10"));
try {
monitor.count(statistics);
monitor.collect(statistics);
int i = 0;
while(monitorService.getStatistics() == null && i < 200) {
i ++;
......
......@@ -27,7 +27,7 @@ public class MockMonitorService implements MonitorService {
private URL statistics;
public void count(URL statistics) {
public void collect(URL statistics) {
this.statistics = statistics;
}
......
......@@ -416,6 +416,10 @@ public class SimpleMonitorService implements MonitorService {
}
public void count(URL statistics) {
collect(statistics);
}
public void collect(URL statistics) {
queue.offer(statistics);
if (logger.isInfoEnabled()) {
logger.info("collect statistics: " + statistics);
......
......@@ -29,7 +29,7 @@ public class SimpleMonitorServiceTest {
@Test
public void testMonitor() {
new SimpleMonitorService().count(new URL("dubbo", NetUtils.getLocalHost(), 0));
new SimpleMonitorService().collect(new URL("dubbo", NetUtils.getLocalHost(), 0));
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册