dugenkui03 opened a new issue #2592: 缓存对象回收 URL: https://github.com/apache/incubator-dubbo/issues/2592 https://github.com/apache/incubator-dubbo/tree/master/dubbo-filter/dubbo-filter-cache/src/main/java/org/apache/dubbo/cache/support/expiring 您好,ExpiringCache对象是否创建了便永远不可被回收? 原因: 1. `ExpiringCache` 对象变量的`store.clear()`方法没有被调用的入口。 2. 获取`ExpiringCache`对象时,会启动线程执行 检查缓存数据是否过期 的任务。任务中有对`ExpiringMap.delegateMap`的引用。**因此即使创建`ExpiringCache`对象的线程终止后,因为 "超时检查线程"的存在,会导致`ExpiringCache`以其引用的对象不能被回收**。 相关代码: ``` //创建缓存对象时调用 expiringMap.getExpireThread().startExpiryIfNotStarted(); //超时检测任务类引用 for (ExpiryObject o : delegateMap.values()) //ExpiringCache无法调用此方法 @Override public void clear() { delegateMap.clear(); expireThread.stopExpiring(); } ```
---------------------------------------------------------------- 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
