Skip to content

Commit

Permalink
In releaseLock wait for result to be sure the lock is removed in memc…
Browse files Browse the repository at this point in the history
…ached.
  • Loading branch information
Martin Grotzke committed Jun 18, 2012
1 parent 564ad89 commit 2d9eb93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ private void releaseLock( @Nonnull final MemcachedBackupSession session ) {
_log.debug( "Releasing lock for session " + session.getIdInternal() );
}
final long start = System.currentTimeMillis();
_memcached.delete( _memcachedNodesManager.getSessionIdFormat().createLockName( session.getIdInternal() ) );
_memcached.delete( _memcachedNodesManager.getSessionIdFormat().createLockName( session.getIdInternal() ) ).get();
_statistics.registerSince( RELEASE_LOCK, start );
session.releaseLock();
} catch( final Exception e ) {
_log.warn( "Caught exception when trying to release lock for session " + session.getIdInternal() );
_log.warn( "Caught exception when trying to release lock for session " + session.getIdInternal(), e );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ private void releaseLock() {
_log.debug( "Releasing lock for session " + _session.getIdInternal() );
}
final long start = System.currentTimeMillis();
_memcached.delete( _memcachedNodesManager.getSessionIdFormat().createLockName( _session.getIdInternal() ) );
_memcached.delete( _memcachedNodesManager.getSessionIdFormat().createLockName( _session.getIdInternal() ) ).get();
_statistics.registerSince( RELEASE_LOCK, start );
_session.releaseLock();
} catch( final Exception e ) {
_log.warn( "Caught exception when trying to release lock for session " + _session.getIdInternal() );
_log.warn( "Caught exception when trying to release lock for session " + _session.getIdInternal(), e );
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/de/javakaffee/web/msm/LockingStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ protected void releaseLock( @Nonnull final String sessionId ) {
_log.debug( "Releasing lock for session " + sessionId );
}
final long start = System.currentTimeMillis();
_memcached.delete( _sessionIdFormat.createLockName( sessionId ) );
_memcached.delete( _sessionIdFormat.createLockName( sessionId ) ).get();
_stats.registerSince( RELEASE_LOCK, start );
} catch ( final Exception e ) {
_log.warn( "Caught exception when trying to release lock for session " + sessionId );
_log.warn( "Caught exception when trying to release lock for session " + sessionId, e );
}
}

Expand Down

0 comments on commit 2d9eb93

Please sign in to comment.