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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <spearce@xxxxxxxxxxx>
---
 .../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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux