Skip to content

Commit

Permalink
OAK-4622 SessionDelegate.lock speedup
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1754515 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
thomasmueller committed Jul 29, 2016
1 parent 117530c commit 8dc07e6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -735,19 +735,19 @@ private WarningLock(Lock lock) {
this.lock = lock;
}

public void lock(boolean isUpdate, String opName) {
public void lock(boolean isUpdate, Object operation) {
if (!lock.tryLock()) {
// Acquire the lock before logging the warnings. As otherwise race conditions
// on the involved fields might lead to wrong warnings.
lock.lock();
if (holderThread != null) {
if (this.isUpdate) {
warn(log, "Attempted to perform " + opName + " while thread " + holderThread +
warn(log, "Attempted to perform " + operation.toString() + " while thread " + holderThread +
" was concurrently writing to this session. Blocked until the " +
"other thread finished using this session. Please review your code " +
"to avoid concurrent use of a session.", holderTrace);
} else if (log.isDebugEnabled()) {
log.debug("Attempted to perform " + opName + " while thread " + holderThread +
log.debug("Attempted to perform " + operation.toString() + " while thread " + holderThread +
" was concurrently reading from this session. Blocked until the " +
"other thread finished using this session. Please review your code " +
"to avoid concurrent use of a session.", holderTrace);
Expand All @@ -770,7 +770,7 @@ private static void warn(Logger logger, String message, Exception stackTrace) {
}

public void lock(SessionOperation<?> sessionOperation) {
lock(sessionOperation.isUpdate(), sessionOperation.toString());
lock(sessionOperation.isUpdate(), sessionOperation);
}

@Override
Expand Down

0 comments on commit 8dc07e6

Please sign in to comment.