We really should try to avoid allocating the reverse index within
the pack object itself, and instead make the applications that do
use this data manage it themselves. This way the index could be
released in memory when its no longer used, and the locking could
be bypassed entirely.
Since most of PackFile is dependent upon the WindowedFile we can
mostly ignore synchronization in this class.
Signed-off-by: Shawn O. Pearce <redacted>
---
.../src/org/spearce/jgit/lib/PackFile.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackFile.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackFile.java
index 6cd85b1..ca5681b 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackFile.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackFile.java
@@ -341,7 +341,7 @@ private long findEndOffset(final long startOffset)
return getReverseIdx().findNextOffset(startOffset, maxOffset);
}
- private PackReverseIndex getReverseIdx() {
+ private synchronized PackReverseIndex getReverseIdx() {
if (reverseIdx == null)
reverseIdx = new PackReverseIndex(idx);
return reverseIdx;--
1.6.1.rc4.301.g5497a