Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Made RepositoryItemUid #getLock and #getAttributeLock the same
Browse files Browse the repository at this point in the history
Both DefaultRepositoryItemUid #getLock and #getAttributeLock lazy
initialized and returned the same DefaultRepositoryItemUid.lock
member. This means that both methods returned the same value for
any given itemUid instance. Most likely this was always item lock,
but the code is too convoluted to tell if any code paths used
attribute lock.

To guarantee consistent use of locks, made both #getLock and
and #getAttributeLock always return the same item lock.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
  • Loading branch information
ifedorenko committed Mar 15, 2013
1 parent c0d30fb commit aa7a615
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,11 @@ public synchronized RepositoryItemUidLock getLock()

return lock;
}

@Override
public synchronized RepositoryItemUidLock getAttributeLock()
{
if ( lock == null )
{
lock = factory.createUidAttributeLock( this );
}

return lock;
return getLock();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public interface RepositoryItemUid
* As you can see on {@link RepositoryItemUidLock#unlock()} method javadoc, last of the boxed unlocks (if any boxing
* at all, simply last invocation) also releases the lazily created lock.
*
* @deprecated this method is fully equivalent to {@link #getLock()}
*
* @return
*/
RepositoryItemUidLock getAttributeLock();
Expand Down

0 comments on commit aa7a615

Please sign in to comment.