org.jboss.kernel.plugins.annotations.wb
Class CompositeKey<T,U>

java.lang.Object
  extended by org.jboss.kernel.plugins.annotations.wb.CompositeKey<T,U>
Type Parameters:
T - exact weak part type
U - rest of the composite key

public abstract class CompositeKey<T,U>
extends Object

Composite map key with weak part notion.

Author:
Ales Justin, Brian Stansberry

Constructor Summary
protected CompositeKey(T weakPart, U[] rest)
           
 
Method Summary
 boolean equals(Object obj)
           
protected abstract  ReferenceQueue<T> getReferenceQueue()
          Get the reference queue holding gced references.
protected  int getRestHashCode()
          Get rest hash code.
protected  int getWeakPartHashCode()
          Get weak part hash code.
 int hashCode()
           
protected static int safeWeakHaskHode(WeakReference wr)
          Get hash code from weak ref.
protected  boolean shouldCleanKeyRefs()
          Allows optimization; i.e.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeKey

protected CompositeKey(T weakPart,
                       U[] rest)
Method Detail

getReferenceQueue

protected abstract ReferenceQueue<T> getReferenceQueue()
Get the reference queue holding gced references.

Returns:
the reference queue

safeWeakHaskHode

protected static int safeWeakHaskHode(WeakReference wr)
Get hash code from weak ref. If already null return zero.

Parameters:
wr - the weak reference
Returns:
wr's value hash code

getWeakPartHashCode

protected int getWeakPartHashCode()
Get weak part hash code.

Returns:
the weak part hash code

getRestHashCode

protected int getRestHashCode()
Get rest hash code.

Returns:
the rest hash code

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

shouldCleanKeyRefs

protected boolean shouldCleanKeyRefs()
Allows optimization; i.e. change to only poll the queue every X invocations.

Returns:
true if we should clean refs


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.