Class ReadWriteMonitor
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.search.indexing.ReadWriteMonitor
Monitor ensuring no more than one writer working concurrently.
Multiple readers are allowed to perform simultaneously.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Concurrent reading is allowed Blocking only when already writing.void
Only one writer at a time is allowed to perform Blocking only when already writing or reading.void
exitRead()
Only notify waiting writer(s) if last readerboolean
Atomic exitRead/enterWrite: Allows to keep monitor in between exit read and next enter write.void
When writing is over, all readers and possible writers are granted permission to restart concurrentlyvoid
Atomic exitWrite/enterRead: Allows to keep monitor in between exit write and next enter read.toString()
-
Constructor Details
-
ReadWriteMonitor
public ReadWriteMonitor()
-
-
Method Details
-
enterRead
public void enterRead()Concurrent reading is allowed Blocking only when already writing. -
enterWrite
public void enterWrite()Only one writer at a time is allowed to perform Blocking only when already writing or reading. -
exitRead
public void exitRead()Only notify waiting writer(s) if last reader -
exitWrite
public void exitWrite()When writing is over, all readers and possible writers are granted permission to restart concurrently -
exitReadEnterWrite
public boolean exitReadEnterWrite()Atomic exitRead/enterWrite: Allows to keep monitor in between exit read and next enter write. Use when writing changes is optional, otherwise call the individual methods. Returns false if multiple readers are accessing the index. -
exitWriteEnterRead
public void exitWriteEnterRead()Atomic exitWrite/enterRead: Allows to keep monitor in between exit write and next enter read. When writing is over, all readers are granted permissing to restart concurrently. This is the same as:synchronized(monitor) { monitor.exitWrite(); monitor.enterRead(); }
-
toString
-