java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.search.indexing.ReadWriteMonitor

public class ReadWriteMonitor extends Object
Monitor ensuring no more than one writer working concurrently. Multiple readers are allowed to perform simultaneously.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    Only notify waiting writer(s) if last reader
    boolean
    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 concurrently
    void
    Atomic exitWrite/enterRead: Allows to keep monitor in between exit write and next enter read.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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

      public String toString()
      Overrides:
      toString in class Object