|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.alfresco.util.ReadWriteLockExecuter
public abstract class ReadWriteLockExecuter
Utility object that wraps read and write methods within the context of a
ReentrantReadWriteLock. The callback's methods are best-suited
to fetching values from a cache or protecting members that need lazy
initialization.
Client code should construct an instance of this class for each resource (or set of resources) that need to be protected.
| Constructor Summary | |
|---|---|
ReadWriteLockExecuter()
Default constructor |
|
| Method Summary | |
|---|---|
java.lang.Object |
execute()
|
protected abstract java.lang.Object |
getWithReadLock()
Execute the read-only part of the work. |
protected abstract java.lang.Object |
getWithWriteLock()
Execute the write part of the work. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReadWriteLockExecuter()
| Method Detail |
|---|
protected abstract java.lang.Object getWithReadLock()
throws java.lang.Throwable
ReadWriteLockExecuter.getWithWriteLock() method must be
called
java.lang.Throwable - all checked exceptions are wrapped in a RuntimeException
protected abstract java.lang.Object getWithWriteLock()
throws java.lang.Throwable
NOTE: It is important to perform a double-check on the resource
before assuming it is not null; there is a window between the ReadWriteLockExecuter.getWithReadLock()
and the ReadWriteLockExecuter.getWithWriteLock() during which another thread may have populated
the resource of interest.
java.lang.Throwable - all checked exceptions are wrapped in a RuntimeExceptionpublic java.lang.Object execute()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||