From 8b20f2c89030591b645a9e349d6f94c065ace0e6 Mon Sep 17 00:00:00 2001 From: Terry Parker Date: Tue, 16 Jun 2015 10:05:29 -0700 Subject: [PATCH] Update comments about PackStatistics Change-Id: I4862932dc38b58cc98400ed584cc506013846065 Signed-off-by: Terry Parker --- .../jgit/internal/storage/pack/PackWriter.java | 4 ++-- .../eclipse/jgit/storage/pack/PackStatistics.java | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 2582deb30..bd0b0e7c3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -1032,8 +1032,8 @@ public void writePack(ProgressMonitor compressMonitor, /** * @return description of what this PackWriter did in order to create the - * final pack stream. The object is only available to callers after - * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)} + * final pack stream. This should only be invoked after the calls to + * create the pack/index/bitmap have completed. */ public PackStatistics getStatistics() { return new PackStatistics(stats); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java index ab9b5e7f6..24efb943c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java @@ -101,6 +101,12 @@ public static class Accumulator { * the accumulator of the statistics */ public ObjectType(ObjectType.Accumulator accumulator) { + /* + * For efficiency this wraps and serves up the Accumulator object + * rather than making a deep clone. Normal usage of PackWriter is to + * create a single pack/index/bitmap and only call getStatistics() + * after all work is complete. + */ objectType = accumulator; } @@ -251,8 +257,12 @@ public static class Accumulator { * the accumulator of the statistics */ public PackStatistics(Accumulator accumulator) { - // Note: PackStatistics directly serves up the collections in the - // accumulator. + /* + * For efficiency this wraps and serves up the Accumulator object rather + * than making a deep clone. Normal usage of PackWriter is to create a + * single pack/index/bitmap and only call getStatistics() after all work + * is complete. + */ statistics = accumulator; }