You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "dugenkui03 (GitHub)" <gi...@apache.org> on 2018/09/30 17:50:54 UTC

[GitHub] [incubator-dubbo] dugenkui03 opened issue #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();
}
```

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2592 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] carryxyh commented on issue #2592: Cache object recovery

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
Close via https://github.com/apache/incubator-dubbo/pull/2594
a complete set of expiration policies is wanted.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2592 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] beiwei30 commented on issue #2592: 缓存对象回收

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
@dugenkui03 with the clear method introduced on `Cache` interface, how do you plan to use it?

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2592 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on issue #2592: 缓存对象回收

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> @dugenkui03 with the clear method introduced on `Cache` interface, how do you plan to use it?

@beiwei30 when we want to invalidate a ExpiringCache object and gc it.for example,yesterday's data does not apply today.

i think there should be implements of 'clear' and 'remove',because high-performance cache alway use "Future" as Value-If a calculation is canceled or fails, it needs to be removed from the cache. this idea can be found in 《java并发编程实战 java Concurrency in practice》5.6,page 87.

details in [PR](https://github.com/apache/incubator-dubbo/pull/2594)

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2592 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] carryxyh closed issue #2592: Cache object recovery

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
[ issue closed by carryxyh ]

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2592 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] dugenkui03 commented on issue #2592: 缓存对象回收

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> @dugenkui03 with the clear method introduced on `Cache` interface, how do you plan to use it?

@beiwei30 when we want to invalidate a ExpiringCache object and gc it.for example,yesterday's data does not apply today.

i think there should be implements of 'clear' and 'remove',because high-performance cache alway use "Future" as Value-If a calculation is canceled or fails, it needs to be removed from the cache. this idea can be found in 《java并发编程实战java Concurrency in practiceh》5.6,page 87.

details in [PR](https://github.com/apache/incubator-dubbo/pull/2594)

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2592 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] dugenkui03 commented on issue #2592: 缓存对象回收

Posted by "dugenkui03 (GitHub)" <gi...@apache.org>.
> @dugenkui03 with the clear method introduced on `Cache` interface, how do you plan to use it?

@beiwei30 when we want to invalidate a ExpiringCache object and gc it.for example,yesterday's data does not apply today.

i think there should be implements of 'clear' and 'remove',because high-performance cache alway use "Future" as Value-If a calculation is canceled or fails, it needs to be removed from the cache. this idea can be found in 《java并发编程实战》5.6,page 87(<java Concurrency in practiceh>).

details in [PR](https://github.com/apache/incubator-dubbo/pull/2594)

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2592 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org