Subject: Re: [JGIT RFC PATCH 2/2] Rewrite WindowCache to be easier to follow and maintain

From: "Shawn O. Pearce" <[email-masked]>
Date: Wed, 29 Apr 2009 10:16:59 -0700

Robin Rosenberg <[email-masked]> wrote:
> > diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/OffsetCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/OffsetCache.java
> > +	private void gc() {
> > +		R r;
> > +		while ((r = (R) queue.poll()) != null) {
> > +			// Sun's Java 5 and 6 implementation have a bug where a Reference
> > +			// can be enqueued and dequeued twice on the same reference queue
> > +			// due to a race condition within ReferenceQueue.enqueue(Reference).
> 
> Reference to the official Sun bug? Might help if someone wants to
> implement a flag to avoid this (if necessary...)

Actually, this is a new bug.  I tried looking through BugParade
but nobody has mentioned or discovered this before.

I submitted a bug report yesterday, but they have yet to publish it.

So, no link.
 
> > +	protected int hash(final int packHash, final long position) {
> > +		return (packHash + (int) (position >>> 4)) >>> 1;
> > +	}
>
> Since we never use the baselass this one isn't covered... ok anyway I think.

This particular implementation I planned on using in
UnpackedObjectCache if I rewrote it using OffsetCache.

But I could also just make it abstract here.  Maybe that is the
better approach.  I'll amend that into the series.
 
-- 
Shawn.