chickenlj commented on issue #1634: 为什么要在AbstractMonitorFactory#getMonitor这个地方要用上锁 URL: https://github.com/apache/incubator-dubbo/issues/1634#issuecomment-383270026 I think you should look at this `LOCK` as a whole, we have null check before entering this lock: ```java Monitor monitor = MONITORS.get(key); Future<Monitor> future = FUTURES.get(key); if (monitor != null || future != null) { return monitor; } LOCK.lock(); try { monitor = MONITORS.get(key); future = FUTURES.get(key); if (monitor != null || future != null) { return monitor; } final URL monitorUrl = url; final ListenableFutureTask<Monitor> listenableFutureTask = ListenableFutureTask.create(new MonitorCreator(monitorUrl)); listenableFutureTask.addListener(new MonitorListener(key)); executor.execute(listenableFutureTask); FUTURES.put(key, listenableFutureTask); return null; } finally { // unlock LOCK.unlock(); } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
