| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private @Nullable DatabaseChangeMonitor. | |
| private boolean | |
| private final BibDatabaseContext | |
| private final DialogService | |
| private final FileUpdateMonitor | |
| private @Nullable FileSnapshot | knownDiskState
State of the monitored file as of the last scan or the last point where the in-memory library was known to match the disk (library load, successful save, all external changes merged). |
| private final LibraryTab | |
| private final List | |
| private static final Logger | |
| private final Optional | |
| private final GuiPreferences | |
| private final StateManager | |
| private final TaskExecutor | |
| private final UndoManager |
| Access | Constructor and Description |
|---|---|
| public | DatabaseChangeMonitor(BibDatabaseContext database, FileUpdateMonitor fileMonitor, TaskExecutor taskExecutor, DialogService dialogService, GuiPreferences preferences, UndoManager undoManager, StateManager stateManager, LibraryTab libraryTab)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv void | applyResolvedChanges(List<DatabaseChange>
the externally resolved changes to apply to the in-memory database resolvedChanges, boolean true if the accepted result now matches the file on disk, so the library can be marked clean; false if the resolved result differs from disk and still needs savingApplies the accepted external changes and updates the library's dirty state. |
| private void | |
| public void | |
| public void | markConsistentWithDisk(@Nullable FileSnapshot
the matching on-disk state, ideally as reported by the writer that committed it (captured right after the commit, this leaves no window in which a concurrent write could be mistaken for the consistent state); diskState)null to read the current state from the file instead, which is subject to such a window — its worst case is a delayed notification, never a lost update, since lost-update protection lives in org.Records the given file state as consistent with the in-memory library. |
| pack-priv void | |
| public void | |
| private void | scanForChanges()
Looks for notable changes of the file on disk compared to the in-memory library and notifies listeners in case there are such changes. |
| private void | scanIfFileChanged()
A full scan parses the whole library file, so it is skipped when size and modification time show that the file has not actually changed since the last known-consistent state — e.g. for events caused by JabRef's own save. |
| public void | suspendChangeDetection()
Defers handling of file events while keeping the watcher registered, so that events arriving during JabRef's own save are neither acted upon (the file may be half-written) nor lost. |
| public void |
| activeNotification | back to summary |
|---|---|
| private @Nullable DatabaseChangeMonitor. | |
| changeDetectionSuspended | back to summary |
|---|---|
| private boolean changeDetectionSuspended | |
| database | back to summary |
|---|---|
| private final BibDatabaseContext database | |
| dialogService | back to summary |
|---|---|
| private final DialogService dialogService | |
| fileMonitor | back to summary |
|---|---|
| private final FileUpdateMonitor fileMonitor | |
| knownDiskState | back to summary |
|---|---|
| private @Nullable FileSnapshot knownDiskState State of the monitored file as of the last scan or the last point where the in-memory library was known to
match the disk (library load, successful save, all external changes merged). Guarded by
| |
| libraryTab | back to summary |
|---|---|
| private final LibraryTab libraryTab | |
| listeners | back to summary |
|---|---|
| private final List<DatabaseChangeListener> listeners | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| monitoredPath | back to summary |
|---|---|
| private final Optional<Path> monitoredPath | |
| preferences | back to summary |
|---|---|
| private final GuiPreferences preferences | |
| stateManager | back to summary |
|---|---|
| private final StateManager stateManager | |
| taskExecutor | back to summary |
|---|---|
| private final TaskExecutor taskExecutor | |
| undoManager | back to summary |
|---|---|
| private final UndoManager undoManager | |
| DatabaseChangeMonitor | back to summary |
|---|---|
| public DatabaseChangeMonitor(BibDatabaseContext database, FileUpdateMonitor fileMonitor, TaskExecutor taskExecutor, DialogService dialogService, GuiPreferences preferences, UndoManager undoManager, StateManager stateManager, LibraryTab libraryTab) | |
| addListener | back to summary |
|---|---|
| public void addListener(DatabaseChangeListener listener) | |
| applyResolvedChanges | back to summary |
|---|---|
| pack-priv void applyResolvedChanges(List<DatabaseChange> resolvedChanges, boolean resolvedChangesMatchDisk) Applies the accepted external changes and updates the library's dirty state.
| |
| clearActiveNotification | back to summary |
|---|---|
| private void clearActiveNotification(DatabaseChangeMonitor. | |
| fileUpdated | back to summary |
|---|---|
public void fileUpdated()
| |
| markConsistentWithDisk | back to summary |
|---|---|
| public void markConsistentWithDisk(@Nullable FileSnapshot diskState) Records the given file state as consistent with the in-memory library. To be called whenever the two are known to match (successful save, all external changes merged), so that watcher events reflecting that very state do not trigger a scan.
| |
| notifyExternalChanges | back to summary |
|---|---|
| pack-priv void notifyExternalChanges(List<DatabaseChange> changes) | |
| resumeChangeDetection | back to summary |
|---|---|
| public void resumeChangeDetection() | |
| scanForChanges | back to summary |
|---|---|
| private void scanForChanges() Looks for notable changes of the file on disk compared to the in-memory library and notifies listeners in case there are such changes. | |
| scanIfFileChanged | back to summary |
|---|---|
| private void scanIfFileChanged() A full scan parses the whole library file, so it is skipped when size and modification time show that the file has not actually changed since the last known-consistent state — e.g. for events caused by JabRef's own save. | |
| suspendChangeDetection | back to summary |
|---|---|
| public void suspendChangeDetection() Defers handling of file events while keeping the watcher registered, so that events arriving during JabRef's own save are neither acted upon (the file may be half-written) nor lost. | |
| unregister | back to summary |
|---|---|
| public void unregister() | |
| Access | Constructor and Description |
|---|---|
| public |
| ExternalLibraryChangeNotification | back to summary |
|---|---|
| public ExternalLibraryChangeNotification(List<DatabaseChange> changes) | |