Thread (17 messages) flat view 17 messages, 3 authors, 2016-06-15
STALE3740d

[JGIT PATCH 05/13] Make PackFile thread-safe

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:45:49
Subsystem: the rest · Maintainer: Linus Torvalds

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help