ostore.cache
Class CacheablePinned

java.lang.Object
  |
  +--ostore.cache.CacheablePinned

public class CacheablePinned
extends Object

Version:
$ID: CacheablePinned.java, v 1.0 handle to a pinned object in the cache. One can trade a CacheablePinned handle to unpin the page. One cannot use the CacheablePinned handle once it is traded in for the CacheableHandle.
Author:
Larry H. Tung

Method Summary
 CacheablePinned clonePin()
           
 Cacheable data()
          returns the pinned block in the cache.
 boolean equals(Object other)
          Compares this CacheablePinned with another , and returns true iff they are the same object.
protected  void finalize()
          If debug has been turned on, the programmer must unpin the CacheablePinned object.
 CacheableIdentity getID()
          returns true if the cached object has an id (CacheableIdentity)
 int getSize()
          returns the size of the block or space taken for this CacheLine
 int hashCode()
          Calculates a Java hash code for this CacheablePinned object.
 boolean hasID()
          returns true if the cached object has an id (CacheableIdentity)
 boolean isPinned()
          Checks to see if the CacheablePinned handle is still valid.
protected  boolean isUnPinned()
           
 int numPins()
          Number of times object referenced by this CacheablePinned is pinned.
 String toString()
          returns a string with the integer represented when this CacheabePinned has been created and the CacheLine associated with this handle
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hasID

public boolean hasID()
returns true if the cached object has an id (CacheableIdentity)


getID

public CacheableIdentity getID()
returns true if the cached object has an id (CacheableIdentity)


data

public Cacheable data()
returns the pinned block in the cache.


getSize

public int getSize()
returns the size of the block or space taken for this CacheLine


isPinned

public boolean isPinned()
Checks to see if the CacheablePinned handle is still valid.
I would prefer you not use this method except for debugging if you must


toString

public String toString()
returns a string with the integer represented when this CacheabePinned has been created and the CacheLine associated with this handle

Overrides:
toString in class Object

numPins

public int numPins()
Number of times object referenced by this CacheablePinned is pinned. Also, this method is not something you should use except for debugging, if you must.


equals

public boolean equals(Object other)
Compares this CacheablePinned with another , and returns true iff they are the same object. i.e. They point to the same place in memory, the are the same reference.

Overrides:
equals in class Object
Parameters:
other - the object with which to compare this CacheablePinned.
Returns:
true iff this and other are the same reference.

hashCode

public int hashCode()
Calculates a Java hash code for this CacheablePinned object. (Returns the Object.hashCode() [i.e. super.hashCode()] which as much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Overrides:
hashCode in class Object
Returns:
the Java hash code for this CacheablePinned.

isUnPinned

protected boolean isUnPinned()

clonePin

public CacheablePinned clonePin()
                         throws CacheMissException
CacheMissException

finalize

protected void finalize()
If debug has been turned on, the programmer must unpin the CacheablePinned object. Else if the programmer has failed to unpin the handle, it will be done during garbage collection.

Overrides:
finalize in class Object