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

关于这插件缓存并发的问题。作者有没有解决方案 #2

Open
mainidear opened this issue Aug 11, 2017 · 0 comments
Open

Comments

@mainidear
Copy link

问题1:这里会出现死锁吧??
private synchronized void clearSessionData() {
queryCacheOnCommit.clear();
updateStatementOnCommit.clear();
}

private synchronized void refreshCache() {
    cachingManager.refreshCacheKey(queryCacheOnCommit);
    // clear the related caches
    cachingManager.clearRelatedCaches(updateStatementOnCommit);
    clearSessionData();
}

问题2:并发问题
protected Object processUpdate(Invocation invocation) throws Throwable {
Object result = invocation.proceed();
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
Map<String ,Object> map = new HashMap();
map.put("id",mappedStatement.getId());
map.put("parameterObject",invocation.getArgs()[1]);
updateStatementOnCommit.add(map);
return result;
}
private synchronized void clearSessionData() {
queryCacheOnCommit.clear();
updateStatementOnCommit.clear();
}
第一个事务执行对updateStatementOnCommit 执行添加时,然后第二个事务执行截图二的方式,那第一个事务的updateStatementOnCommit 添加的值也给清除了。那这样就存在了问题吧???

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