Class ObjectPersister
java.lang.Object
com.atlassian.confluence.impl.backuprestore.restore.persisters.ObjectPersister
Composite persister. Stores imported objects in batches using different persisters.
The purpose of this class is to combine multiple Persisters. The class breaks down the list of imported objects
into smaller batches and stores each batch asynchronously using multiple/different persisters.
- Since:
- 8.2.0
-
Constructor Summary
ConstructorsConstructorDescriptionObjectPersister
(ParallelTasksExecutor parallelTasksExecutor, List<Persister> persisters) ObjectPersister
(ParallelTasksExecutor parallelTasksExecutor, List<Persister> persisters, int batchSize) Provides an ability to change batch size for tests. -
Method Summary
Modifier and TypeMethodDescriptionCollection<Future<?>>
persistAsynchronously
(Collection<ImportedObjectV2> objectsToPersist, String info) Run object persisting asynchronously.Future<?>
persistAsynchronouslyInOneTransaction
(Collection<ImportedObjectV2> objectsToPersist, String info) Persist a collection on objects in one transaction asynchronously.void
waitUntilAllJobsFinish
(Collection<Future<?>> futures)
-
Constructor Details
-
ObjectPersister
-
ObjectPersister
public ObjectPersister(ParallelTasksExecutor parallelTasksExecutor, List<Persister> persisters, int batchSize) Provides an ability to change batch size for tests.
-
-
Method Details
-
persistAsynchronously
public Collection<Future<?>> persistAsynchronously(Collection<ImportedObjectV2> objectsToPersist, String info) Run object persisting asynchronously. Can accept any number of records and can split them to a few partitions and persist them in a few different transactions. Returns the collections of the async task futures. -
persistAsynchronouslyInOneTransaction
public Future<?> persistAsynchronouslyInOneTransaction(Collection<ImportedObjectV2> objectsToPersist, String info) Persist a collection on objects in one transaction asynchronously. It guarantees that all records will be persisted in one and only one transaction. The caller is responsible for not providing large amount of objects. Returns the future of the async persisting task. -
waitUntilAllJobsFinish
- Throws:
BackupRestoreException
-