SIDE EFFECTS:
onFinish in case all entries have been imported (based on the given totalEntries count)
Imports run concurrently: ImportHandler schedules one BackgroundTask chain per entry, so
markImported/markSkipped are invoked from different threads. The mutating methods are therefore
synchronized so that the counter update, list append, completion check, and onFinish execution
happen atomically. This guarantees onFinish runs exactly once and only after every imported entry
is visible in importedEntries.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private int | |
| private final List | |
| private @Nullable Runnable | |
| private int | |
| private final StateManager | |
| private final BibDatabaseContext | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | EntryImportHandlerTracker(StateManager stateManager, BibDatabaseContext targetDatabaseContext, int totalEntries)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | checkDone()
Checks if all entries have been processed; if yes, execute the onFinish action exactly once. |
| public synchronized int | |
| public synchronized List | getImportedEntries()
Returns an immutable snapshot of the actually imported |
| public synchronized int | |
| public synchronized void | |
| public synchronized void | |
| private void | |
| public synchronized void |
| finished | back to summary |
|---|---|
| private boolean finished | |
| imported | back to summary |
|---|---|
| private int imported | |
| importedEntries | back to summary |
|---|---|
| private final List<BibEntry> importedEntries | |
| onFinish | back to summary |
|---|---|
| private @Nullable Runnable onFinish | |
| skipped | back to summary |
|---|---|
| private int skipped | |
| stateManager | back to summary |
|---|---|
| private final StateManager stateManager | |
| targetDatabaseContext | back to summary |
|---|---|
| private final BibDatabaseContext targetDatabaseContext | |
| totalEntries | back to summary |
|---|---|
| private final int totalEntries | |
| EntryImportHandlerTracker | back to summary |
|---|---|
| public EntryImportHandlerTracker(StateManager stateManager, BibDatabaseContext targetDatabaseContext) | |
| EntryImportHandlerTracker | back to summary |
|---|---|
| public EntryImportHandlerTracker(StateManager stateManager, BibDatabaseContext targetDatabaseContext, int totalEntries) | |
| checkDone | back to summary |
|---|---|
| private void checkDone() Checks if all entries have been processed; if yes, execute the onFinish action exactly once.
Must be called while holding this object's monitor (i.e. from a | |
| getImportedCount | back to summary |
|---|---|
| public synchronized int getImportedCount() | |
| getImportedEntries | back to summary |
|---|---|
| public synchronized List Returns an immutable snapshot of the actually imported | |
| getSkippedCount | back to summary |
|---|---|
| public synchronized int getSkippedCount() | |
| markImported | back to summary |
|---|---|
| public synchronized void markImported(BibEntry entry) Marks the given entry as imported | |
| markSkipped | back to summary |
|---|---|
| public synchronized void markSkipped() | |
| selectImportedEntriesInActiveTab | back to summary |
|---|---|
| private void selectImportedEntriesInActiveTab(List<BibEntry> importedEntriesSnapshot) | |
| setOnFinish | back to summary |
|---|---|
| public synchronized void setOnFinish(@Nullable Runnable onFinish) | |