org.eclipse.xtext.util.concurrent
Class AbstractReadWriteAcces<P>
java.lang.Object
org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces<P>
- All Implemented Interfaces:
- IReadAccess<P>
- Direct Known Subclasses:
- XtextDocument.XtextDocumentLocker
public abstract class AbstractReadWriteAcces<P>
- extends java.lang.Object
- implements IReadAccess<P>
- Author:
- Sven Efftinge - Initial contribution and API, Jan Koehnlein
Field Summary |
protected java.util.concurrent.locks.Lock |
readLock
|
protected java.util.concurrent.locks.ReentrantReadWriteLock |
rwLock
|
protected java.util.concurrent.locks.Lock |
writeLock
|
Method Summary |
protected void |
afterModify(P state,
java.lang.Object result,
IUnitOfWork<?,P> work)
is executed within the transaction right after the unit of work has been executed and delivered the result. |
protected void |
afterReadOnly(P state,
java.lang.Object result,
IUnitOfWork<?,P> work)
is executed within the transaction right after the unit of work has been executed and delivered the result. |
protected void |
beforeModify(P state,
IUnitOfWork<?,P> work)
Is called before a write lock is obtained |
protected void |
beforeReadOnly(P state,
IUnitOfWork<?,P> work)
is called before a read lock is obtained |
protected abstract P |
getState()
|
|
modify(IUnitOfWork<T,P> work)
|
|
readOnly(IUnitOfWork<T,P> work)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
rwLock
protected final java.util.concurrent.locks.ReentrantReadWriteLock rwLock
writeLock
protected final java.util.concurrent.locks.Lock writeLock
readLock
protected final java.util.concurrent.locks.Lock readLock
AbstractReadWriteAcces
public AbstractReadWriteAcces()
getState
protected abstract P getState()
readOnly
public <T> T readOnly(IUnitOfWork<T,P> work)
- Specified by:
readOnly
in interface IReadAccess<P>
modify
public <T> T modify(IUnitOfWork<T,P> work)
beforeModify
protected void beforeModify(P state,
IUnitOfWork<?,P> work)
- Is called before a write lock is obtained
- Parameters:
work
- - the unit of work to be processed
beforeReadOnly
protected void beforeReadOnly(P state,
IUnitOfWork<?,P> work)
- is called before a read lock is obtained
- Parameters:
work
- - the unit of work to be processed
afterModify
protected void afterModify(P state,
java.lang.Object result,
IUnitOfWork<?,P> work)
- is executed within the transaction right after the unit of work has been executed and delivered the result.
- Parameters:
result
- work
-
afterReadOnly
protected void afterReadOnly(P state,
java.lang.Object result,
IUnitOfWork<?,P> work)
- is executed within the transaction right after the unit of work has been executed and delivered the result.
- Parameters:
result
- work
-