@Override public void write(T newValue) { // Safely taking the write directory // the whole method can't be in a synchronized block, or // it would block the notifications in case of syncWrite // and would deadlock PVWriterDirector<T> director; synchronized(lock) { director = writeDirector; } if (syncWrite) { director.syncWrite(newValue, this); } else { director.write(newValue, this); } }