Top Description Fields Constructors Methods
org.jabref.gui.autosaveandbackup

public Class AutosaveManager

extends Object
Class Inheritance
Imports
java.util.HashSet, .Set, java.util.concurrent.ScheduledThreadPoolExecutor, .TimeUnit, org.jabref.logic.util.CoarseChangeFilter, org.jabref.model.database.BibDatabaseContext, org.jabref.model.database.event.AutosaveEvent, .BibDatabaseContextChangedEvent, com.google.common.eventbus.EventBus, .Subscribe, org.slf4j.Logger, .LoggerFactory

Saves the given 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.

Field Summary

Modifier and TypeField and Description
private final BibDatabaseContext
private final CoarseChangeFilter
private static final int
private final EventBus
private final ScheduledThreadPoolExecutor
private static final Logger
private boolean
private static Set<AutosaveManager>

Constructor Summary

AccessConstructor and Description
private
AutosaveManager(BibDatabaseContext bibDatabaseContext)

Method Summary

Modifier and TypeMethod and Description
public void
public void
private void
public static void
shutdown(BibDatabaseContext bibDatabaseContext)

Shuts down the Autosaver which is associated with the given BibDatabaseContext.

public static AutosaveManager
start(BibDatabaseContext bibDatabaseContext)

Starts the Autosaver which is associated with the given BibDatabaseContext.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bibDatabaseContextback to summary
private final BibDatabaseContext bibDatabaseContext
changeFilterback to summary
private final CoarseChangeFilter changeFilter
DELAY_BETWEEN_AUTOSAVE_ATTEMPTS_IN_SECONDSback to summary
private static final int DELAY_BETWEEN_AUTOSAVE_ATTEMPTS_IN_SECONDS
eventBusback to summary
private final EventBus eventBus
executorback to summary
private final ScheduledThreadPoolExecutor executor
LOGGERback to summary
private static final Logger LOGGER
needsSaveback to summary
private boolean needsSave
runningInstancesback to summary
private static Set<AutosaveManager> runningInstances

Constructor Detail

AutosaveManagerback to summary
private AutosaveManager(BibDatabaseContext bibDatabaseContext)

Method Detail

listenback to summary
public void listen(BibDatabaseContextChangedEvent event)
Annotations
@Subscribe
registerListenerback to summary
public void registerListener(Object listener)
shutdownback to summary
private void shutdown()
shutdownback to summary
public static void shutdown(BibDatabaseContext bibDatabaseContext)

Shuts down the Autosaver which is associated with the given BibDatabaseContext.

Parameters
bibDatabaseContext:BibDatabaseContext

Associated BibDatabaseContext

startback to summary
public static AutosaveManager start(BibDatabaseContext bibDatabaseContext)

Starts the Autosaver which is associated with the given BibDatabaseContext.

Parameters
bibDatabaseContext:BibDatabaseContext

Associated BibDatabaseContext

unregisterListenerback to summary
public void unregisterListener(Object listener)