From 7e48870003cb77cabac074b6e0d61aeb50ac92c4 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 22 Dec 2008 16:27:15 -0800 Subject: [PATCH] Make PackFile thread-safe 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 Signed-off-by: Robin Rosenberg --- org.spearce.jgit/src/org/spearce/jgit/lib/PackFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6cd85b1c..ca5681bc 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 @@ public class PackFile implements Iterable { return getReverseIdx().findNextOffset(startOffset, maxOffset); } - private PackReverseIndex getReverseIdx() { + private synchronized PackReverseIndex getReverseIdx() { if (reverseIdx == null) reverseIdx = new PackReverseIndex(idx); return reverseIdx; -- 2.11.4.GIT