Class ObjectPersister
- java.lang.Object
-
- com.atlassian.confluence.impl.backuprestore.restore.persisters.ObjectPersister
-
public class ObjectPersister extends Object
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
Constructors Constructor Description ObjectPersister(ParallelTasksExecutor parallelTasksExecutor, List<Persister> persisters)
ObjectPersister(ParallelTasksExecutor parallelTasksExecutor, List<Persister> persisters, int batchSize)
Provides an ability to change batch size for tests.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<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 Detail
-
ObjectPersister
public ObjectPersister(ParallelTasksExecutor parallelTasksExecutor, List<Persister> persisters)
-
ObjectPersister
public ObjectPersister(ParallelTasksExecutor parallelTasksExecutor, List<Persister> persisters, int batchSize)
Provides an ability to change batch size for tests.
-
-
Method Detail
-
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
public void waitUntilAllJobsFinish(Collection<Future<?>> futures) throws BackupRestoreException
- Throws:
BackupRestoreException
-
-