protected void writeLock()
protected final void writeLock()
  protected void writeLock()  {    if (currentWriter != null && currentWriter.equals(Thread.currentThread()))      return;    synchronized (documentCV)      {        numWritersWaiting++;        while (numReaders > 0)          {            try              {                documentCV.wait();              }            catch (InterruptedException ie)              {                throw new Error("interruped while trying to obtain write lock");              }          }        numWritersWaiting --;        currentWriter = Thread.currentThread();      }  }