Class ImportedObjectsStashImpl
- java.lang.Object
-
- com.atlassian.confluence.impl.backuprestore.restore.stash.ImportedObjectsStashImpl
-
- All Implemented Interfaces:
ImportedObjectsStash
public class ImportedObjectsStashImpl extends Object implements ImportedObjectsStash
Allows to temporarily "stash" imported objects and then read them. For performance reasons, current implementation allows to write records first and read them only when all records are written. When the reading started, no more writing is allowed.- Since:
- 7.20.0
-
-
Constructor Summary
Constructors Constructor Description ImportedObjectsStashImpl(String name, int iteration, StashObjectsWriter stashObjectsWriter, StashObjectsReader stashObjectsReader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(ImportedObjectV2 object)
Different threads can add objects to the stash in parallel.Integer
getIterationNumber()
String
getName()
long
getNumberOfRetrievedObjects()
long
getNumberOfWrittenObjects()
boolean
hasMoreRecords()
List<ImportedObjectV2>
readObjects(int numberOfObjects)
Read a collection of objects from the stash.
-
-
-
Constructor Detail
-
ImportedObjectsStashImpl
public ImportedObjectsStashImpl(String name, int iteration, StashObjectsWriter stashObjectsWriter, StashObjectsReader stashObjectsReader)
-
-
Method Detail
-
add
public void add(ImportedObjectV2 object) throws BackupRestoreException
Different threads can add objects to the stash in parallel.- Specified by:
add
in interfaceImportedObjectsStash
- Throws:
BackupRestoreException
-
readObjects
public List<ImportedObjectV2> readObjects(int numberOfObjects) throws BackupRestoreException
Description copied from interface:ImportedObjectsStash
Read a collection of objects from the stash. If the stash has fewer objects than numberOfObjects, all objects will be returned.- Specified by:
readObjects
in interfaceImportedObjectsStash
- Parameters:
numberOfObjects
- number of objects.- Returns:
- collection of objects
- Throws:
BackupRestoreException
-
getName
public String getName()
- Specified by:
getName
in interfaceImportedObjectsStash
- Returns:
- stash name
-
getIterationNumber
public Integer getIterationNumber()
- Specified by:
getIterationNumber
in interfaceImportedObjectsStash
- Returns:
- iteration number
-
getNumberOfWrittenObjects
public long getNumberOfWrittenObjects()
- Specified by:
getNumberOfWrittenObjects
in interfaceImportedObjectsStash
- Returns:
- number of objects written to the stash.
-
getNumberOfRetrievedObjects
public long getNumberOfRetrievedObjects()
- Specified by:
getNumberOfRetrievedObjects
in interfaceImportedObjectsStash
- Returns:
- number of objects read from the stash by this moment.
-
hasMoreRecords
public boolean hasMoreRecords()
- Specified by:
hasMoreRecords
in interfaceImportedObjectsStash
- Returns:
- true if the stash has records to read.
-
-