Re: [JGIT RFC PATCH 2/2] Rewrite WindowCache to be easier to follow and maintain
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Apr 29, 2009, 17:16 UTC
- Message-ID
- <20090429171659.GF23604@spearce.org>
- In-Reply-To
- <200904290120.00039.robin.rosenberg.lists@dewire.com>
Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
Show 10 quoted lines
> > 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.
Show 5 quoted lines
> > + 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.