Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

缓存的close()方法好像有bug #5

Open
YeYuan1107 opened this issue May 14, 2022 · 0 comments
Open

缓存的close()方法好像有bug #5

YeYuan1107 opened this issue May 14, 2022 · 0 comments

Comments

@YeYuan1107
Copy link
Contributor

protected void close() {
        lock.lock();
        try {
            Set<Long> keys = cache.keySet();
            for (long key : keys) {
                release(key);
                references.remove(key);
                cache.remove(key);
            }
        } finally {
            lock.unlock();
        }
}

release()方法在key的引用降到0时才会进行回源,如果key的ref没有到0不就没有回源吗,并没有在关闭的时候把缓存中所有资源回源

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant