HHH-6286 UpdateTimestampsCache should try to avoid acquiring lock if possible

This commit is contained in:
Strong Liu 2011-11-21 20:03:24 +08:00
parent f8e347dabd
commit 17bf50226b
1 changed files with 7 additions and 10 deletions

View File

@ -281,8 +281,10 @@ public class ActionQueue {
beforeTransactionProcesses.register( executable.getBeforeTransactionCompletionProcess() ); beforeTransactionProcesses.register( executable.getBeforeTransactionCompletionProcess() );
if ( session.getFactory().getSettings().isQueryCacheEnabled() ) { if ( session.getFactory().getSettings().isQueryCacheEnabled() ) {
final String[] spaces = (String[]) executable.getPropertySpaces(); final String[] spaces = (String[]) executable.getPropertySpaces();
afterTransactionProcesses.addSpacesToInvalidate( spaces ); if ( spaces != null && spaces.length > 0 ) { //HHH-6286
session.getFactory().getUpdateTimestampsCache().preinvalidate( spaces ); afterTransactionProcesses.addSpacesToInvalidate( spaces );
session.getFactory().getUpdateTimestampsCache().preinvalidate( spaces );
}
} }
afterTransactionProcesses.register( executable.getAfterTransactionCompletionProcess() ); afterTransactionProcesses.register( executable.getAfterTransactionCompletionProcess() );
} }
@ -577,11 +579,8 @@ public class ActionQueue {
} }
public void addSpacesToInvalidate(String[] spaces) { public void addSpacesToInvalidate(String[] spaces) {
if ( spaces == null ) { for ( String space : spaces ) {
return; addSpaceToInvalidate( space );
}
for ( int i = 0, max = spaces.length; i < max; i++ ) {
addSpaceToInvalidate( spaces[i] );
} }
} }
@ -597,10 +596,8 @@ public class ActionQueue {
} }
public void afterTransactionCompletion(boolean success) { public void afterTransactionCompletion(boolean success) {
final int size = processes.size(); for ( AfterTransactionCompletionProcess process : processes ) {
for ( int i = 0; i < size; i++ ) {
try { try {
AfterTransactionCompletionProcess process = processes.get( i );
process.doAfterTransactionCompletion( success, session ); process.doAfterTransactionCompletion( success, session );
} }
catch ( CacheException ce ) { catch ( CacheException ce ) {