BibDatabaseContext on every BibDatabaseContextChangedEvent by posting a new AutosaveEvent.
An intelligent ScheduledThreadPoolExecutor prevents a high load while saving and rejects all redundant save tasks.
The scheduled action is stored and canceled if a newer save action is proposed.
| Modifier and Type | Field and Description |
|---|---|
| private final BibDatabaseContext | |
| private final CoarseChangeFilter | |
| private static final int | |
| private final EventBus | |
| private final ScheduledThreadPoolExecutor | |
| private static final Logger | |
| private final AtomicBoolean | |
| private static Set |
| Access | Constructor and Description |
|---|---|
| private | |
| pack-priv | AutosaveManager(BibDatabaseContext bibDatabaseContext, CoarseChangeFilter coarseChangeFilter, ScheduledThreadPoolExecutor executor)
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| public void | listen(BibDatabaseContextChangedEvent event)
Every change counts, including the keystrokes the filter marks as minor: the filter exists to spare listeners expensive work per keystroke, but a flag is cheap and the timer throttles the saves anyway. |
| public void | |
| pack-priv synchronized void | |
| public static void | shutdown(BibDatabaseContext
Associated bibDatabaseContext)BibDatabaseContextShuts down the Autosaver which is associated with the given |
| public static AutosaveManager | start(BibDatabaseContext
Associated bibDatabaseContext, CoarseChangeFilter coarseChangeFilter)BibDatabaseContextStarts the Autosaver which is associated with the given |
| public void |
| bibDatabaseContext | back to summary |
|---|---|
| private final BibDatabaseContext bibDatabaseContext | |
| coarseChangeFilter | back to summary |
|---|---|
| private final CoarseChangeFilter coarseChangeFilter | |
| DELAY_BETWEEN_AUTOSAVE_ATTEMPTS_IN_SECONDS | back to summary |
|---|---|
| private static final int DELAY_BETWEEN_AUTOSAVE_ATTEMPTS_IN_SECONDS | |
| eventBus | back to summary |
|---|---|
| private final EventBus eventBus | |
| executor | back to summary |
|---|---|
| private final ScheduledThreadPoolExecutor executor | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| needsSave | back to summary |
|---|---|
| private final AtomicBoolean needsSave | |
| runningInstances | back to summary |
|---|---|
| private static Set<AutosaveManager> runningInstances | |
| AutosaveManager | back to summary |
|---|---|
| private AutosaveManager(BibDatabaseContext bibDatabaseContext, CoarseChangeFilter coarseChangeFilter) | |
| AutosaveManager | back to summary |
|---|---|
| pack-priv AutosaveManager(BibDatabaseContext bibDatabaseContext, CoarseChangeFilter coarseChangeFilter, ScheduledThreadPoolExecutor executor) | |
| isSavePending | back to summary |
|---|---|
| pack-priv boolean isSavePending() | |
| listen | back to summary |
|---|---|
| public void listen(BibDatabaseContextChangedEvent event) Every change counts, including the keystrokes the filter marks as minor: the filter exists to spare listeners expensive work per keystroke, but a flag is cheap and the timer throttles the saves anyway. Ignoring minor changes would leave a field the user only types in unsaved until the user moves to another field.
| |
| registerListener | back to summary |
|---|---|
| public void registerListener(Object listener) | |
| shutdown | back to summary |
|---|---|
| pack-priv synchronized void shutdown() | |
| shutdown | back to summary |
|---|---|
| public static void shutdown(BibDatabaseContext bibDatabaseContext) Shuts down the Autosaver which is associated with the given
| |
| start | back to summary |
|---|---|
| public static AutosaveManager start(BibDatabaseContext bibDatabaseContext, CoarseChangeFilter coarseChangeFilter) Starts the Autosaver which is associated with the given
| |
| unregisterListener | back to summary |
|---|---|
| public void unregisterListener(Object listener) | |