diff --git a/accession-commons-monotonic-generator-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/generators/monotonic/BlockManager.java b/accession-commons-monotonic-generator-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/generators/monotonic/BlockManager.java index d47ab906..6735a4c5 100644 --- a/accession-commons-monotonic-generator-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/generators/monotonic/BlockManager.java +++ b/accession-commons-monotonic-generator-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/generators/monotonic/BlockManager.java @@ -157,7 +157,7 @@ private void doRelease(long[] accessions) { * @param committedElements Accessions that have already been committed * @throws AccessionIsNotPendingException When the generated accession does not match with the accession to commit */ - public void recoverState(long[] committedElements) throws AccessionIsNotPendingException { + public Set recoverState(long[] committedElements) throws AccessionIsNotPendingException { List ranges = MonotonicRange.convertToMonotonicRanges(committedElements); List newAvailableRanges = new ArrayList<>(); for (MonotonicRange monotonicRange : this.availableRanges) { @@ -166,6 +166,6 @@ public void recoverState(long[] committedElements) throws AccessionIsNotPendingE this.availableRanges.clear(); this.availableRanges.addAll(newAvailableRanges); - doCommit(committedElements); + return doCommit(committedElements); } } diff --git a/accession-commons-monotonic-generator-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/generators/monotonic/MonotonicAccessionGenerator.java b/accession-commons-monotonic-generator-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/generators/monotonic/MonotonicAccessionGenerator.java index 16e7836f..73c8a88c 100644 --- a/accession-commons-monotonic-generator-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/generators/monotonic/MonotonicAccessionGenerator.java +++ b/accession-commons-monotonic-generator-jpa/src/main/java/uk/ac/ebi/ampt2d/commons/accession/generators/monotonic/MonotonicAccessionGenerator.java @@ -103,7 +103,7 @@ private static void assertBlockParametersAreInitialized(ContiguousIdBlockService * @throws AccessionIsNotPendingException */ private void recoverState(long[] committedElements) throws AccessionIsNotPendingException { - blockManager.recoverState(committedElements); + blockService.save(blockManager.recoverState(committedElements)); } public synchronized long[] generateAccessions(int numAccessionsToGenerate)