git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH 2/3] Simulate breakpoints

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Apr 19, 2009, 18:30 UTC
Message-ID
<1240165809-16703-3-git-send-email-robin.rosenberg@dewire.com>
In-Reply-To
<1240165809-16703-2-git-send-email-robin.rosenberg@dewire.com>
---
 .../tst/org/spearce/jgit/lib/WindowCacheTest.java  |    7 +++++++
 .../src/org/spearce/jgit/lib/WindowedFile.java     |    7 +++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/WindowCacheTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/WindowCacheTest.java
index 0cd55c9..eba1aed 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/WindowCacheTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/WindowCacheTest.java
@@ -98,6 +98,13 @@ public void testObjectMovedToNewPack() throws IncorrectObjectTypeException,
 
 		// Now here is the interesting thing. Will git figure the new
 		// object exists in the new pack, and not the old one.
+		try {
+			Thread.sleep(2000);
+		} catch (InterruptedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		System.gc();
 		assertEquals(o1.name(), new RevWalk(db).parseAny(o1).name());
 	}
 
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowedFile.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowedFile.java
index 938f44c..f7377d1 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowedFile.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowedFile.java
@@ -280,6 +280,13 @@ public void close() {
 	}
 
 	void cacheOpen() throws IOException {
+		try {
+			Thread.sleep(2000);
+		} catch (InterruptedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		System.gc();
 		fd = new RandomAccessFile(fPath, "r");
 		length = fd.length();
 		try {
-- 
1.6.2.2.446.gfbdc0
Previous: Robin RosenbergNext: Robin Rosenberg
Message 4 of 6 in “JGit cache bug”
  1. Robin RosenbergApr 18, 2009
  2. 0/3 http://code.google.com/p/egit/issues/detail?id=79Robin Rosenberg, Apr 19, 2009
  3. 1/3 Add test cases dedicated to the WindowCacheRobin Rosenberg, Apr 19, 2009
  4. 2/3 Simulate breakpointsRobin Rosenberg, Apr 19, 2009
  5. 3/3 Rescan for packs and retry once if object lookup scan failsRobin Rosenberg, Apr 19, 2009
  6. Shawn O. PearceApr 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.