diff --git a/dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java b/dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java index 74a129b99b5..9708e905a49 100644 --- a/dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java +++ b/dubbo-monitor/dubbo-monitor-api/src/main/java/org/apache/dubbo/monitor/support/AbstractMonitorFactory.java @@ -85,8 +85,8 @@ public Monitor getMonitor(URL url) { final URL monitorUrl = url; final CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> AbstractMonitorFactory.this.createMonitor(monitorUrl)); - completableFuture.thenRunAsync(new MonitorListener(key), executor); FUTURES.put(key, completableFuture); + completableFuture.thenRunAsync(new MonitorListener(key), executor); return null; } finally { diff --git a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorTest.java b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorTest.java index 039f4e32e6b..67c7a5a4eb6 100644 --- a/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorTest.java +++ b/dubbo-monitor/dubbo-monitor-default/src/test/java/org/apache/dubbo/monitor/dubbo/DubboMonitorTest.java @@ -61,7 +61,7 @@ public Class getInterface() { } public URL getUrl() { - return URL.valueOf("dubbo://127.0.0.1:7070?interval=20"); + return URL.valueOf("dubbo://127.0.0.1:7070?interval=1000"); } @Override