void firePvValueChanged() { int notificationMask = 0; PVReaderEvent<T> event; synchronized(lock) { if (connectionToNotify) { notificationMask += PVReaderEvent.CONNECTION_MASK; } if (valueToNotify) { notificationMask += PVReaderEvent.VALUE_MASK; } if (exceptionToNotify) { notificationMask += PVReaderEvent.EXCEPTION_MASK; } connectionToNotify = false; valueToNotify = false; exceptionToNotify = false; sentFirstEvent = true; event = new PVReaderEvent<>(notificationMask, readerForNotification); } for (PVReaderListener<T> listener : pvReaderListeners) { listener.pvChanged(event); } }