Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.store.raw.data
Class RecordId  view RecordId download RecordId.java

java.lang.Object
  extended byorg.apache.derby.impl.store.raw.data.RecordId
All Implemented Interfaces:
org.apache.derby.iapi.services.locks.Lockable, org.apache.derby.iapi.store.raw.RecordHandle

public final class RecordId
extends java.lang.Object
implements org.apache.derby.iapi.store.raw.RecordHandle

Implementation of RecordHandle.
MT - Mutable - Immutable identity : Thread Aware -
The methods of RecordHandle only access the identity of the object and so the object appears immutable to them, as required.
The methods of Lockable are single thread required.


Field Summary
private  org.apache.derby.iapi.store.raw.PageKey pageId
          Page the record lives in.
private  int recordId
          The actual record id.
private  int slotNumberHint
          Last slot number this record id was at.
 
Fields inherited from interface org.apache.derby.iapi.store.raw.RecordHandle
DEALLOCATE_PROTECTION_HANDLE, FIRST_RECORD_ID, INVALID_RECORD_HANDLE, PREVIOUS_KEY_HANDLE, RECORD_ID_PROTECTION_HANDLE, RESERVED4_RECORD_HANDLE, RESERVED5_RECORD_HANDLE
 
Constructor Summary
RecordId(org.apache.derby.iapi.store.raw.ContainerKey container, long pageNumber, int recordId)
           
RecordId(org.apache.derby.iapi.store.raw.PageKey pageId, int recordId)
           
RecordId(org.apache.derby.iapi.store.raw.PageKey pageId, int recordId, int current_slot)
           
 
Method Summary
 boolean equals(java.lang.Object ref)
          Implement value equality.
 org.apache.derby.iapi.store.raw.ContainerKey getContainerId()
          Return the identity of my container.
 int getId()
          Get my record id.
 java.lang.Object getPageId()
          Return the identity of my Page.
 long getPageNumber()
          Get my page number.
 int getSlotNumberHint()
          What slot number might the record be at?
 int hashCode()
          Return a hashcode based on value.
 boolean lockAttributes(int flag, java.util.Hashtable attributes)
          This lockable wants to participate in the Virtual Lock table.
 boolean lockerAlwaysCompatible()
          Is a caller that holds a lock compatible with themselves?
 void lockEvent(org.apache.derby.iapi.services.locks.Latch lockInfo)
          Lock me.
 boolean requestCompatible(java.lang.Object requestedQualifier, java.lang.Object grantedQualifier)
          Determine if this request can be granted.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void unlockEvent(org.apache.derby.iapi.services.locks.Latch lockInfo)
          Unlock me.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

pageId

private final org.apache.derby.iapi.store.raw.PageKey pageId
Page the record lives in. MT - Immutable


recordId

private final int recordId
The actual record id. MT - Immutable


slotNumberHint

private transient int slotNumberHint
Last slot number this record id was at.

Constructor Detail

RecordId

public RecordId(org.apache.derby.iapi.store.raw.ContainerKey container,
                long pageNumber,
                int recordId)

RecordId

public RecordId(org.apache.derby.iapi.store.raw.PageKey pageId,
                int recordId)

RecordId

public RecordId(org.apache.derby.iapi.store.raw.PageKey pageId,
                int recordId,
                int current_slot)
Method Detail

getId

public int getId()
Get my record id.
MT - thread safe

Specified by:
getId in interface org.apache.derby.iapi.store.raw.RecordHandle

getPageNumber

public long getPageNumber()
Get my page number.
MT - thread safe

Specified by:
getPageNumber in interface org.apache.derby.iapi.store.raw.RecordHandle

getPageId

public java.lang.Object getPageId()
Description copied from interface: org.apache.derby.iapi.store.raw.RecordHandle
Return the identity of my Page.

Specified by:
getPageId in interface org.apache.derby.iapi.store.raw.RecordHandle

getContainerId

public org.apache.derby.iapi.store.raw.ContainerKey getContainerId()
Description copied from interface: org.apache.derby.iapi.store.raw.RecordHandle
Return the identity of my container.

Specified by:
getContainerId in interface org.apache.derby.iapi.store.raw.RecordHandle

getSlotNumberHint

public int getSlotNumberHint()
What slot number might the record be at?

The raw store guarantees that the record handle of a record will not change, but its slot number may. When a RecordId is constructed the caller could have provided a slot number, if so return that slot number hint here. If a hint was not provided then the default Page.FIRST_SLOT_NUMBER will be returned.

Specified by:
getSlotNumberHint in interface org.apache.derby.iapi.store.raw.RecordHandle

lockEvent

public void lockEvent(org.apache.derby.iapi.services.locks.Latch lockInfo)
Lock me.
MT - Single thread required (methods of Lockable)

Specified by:
lockEvent in interface org.apache.derby.iapi.services.locks.Lockable

requestCompatible

public boolean requestCompatible(java.lang.Object requestedQualifier,
                                 java.lang.Object grantedQualifier)
Determine if this request can be granted. MT - Single thread required (methods of Lockable)

Specified by:
requestCompatible in interface org.apache.derby.iapi.services.locks.Lockable

lockerAlwaysCompatible

public boolean lockerAlwaysCompatible()
Is a caller that holds a lock compatible with themselves?

Row locks held in the same transaction are always compatible with themselves.
MT - Single thread required (methods of Lockable)

Specified by:
lockerAlwaysCompatible in interface org.apache.derby.iapi.services.locks.Lockable

unlockEvent

public void unlockEvent(org.apache.derby.iapi.services.locks.Latch lockInfo)
Unlock me.
MT - Single thread required (methods of Lockable)

Specified by:
unlockEvent in interface org.apache.derby.iapi.services.locks.Lockable

equals

public boolean equals(java.lang.Object ref)
Implement value equality.
MT - Thread safe


hashCode

public int hashCode()
Return a hashcode based on value.
MT - thread safe


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


lockAttributes

public boolean lockAttributes(int flag,
                              java.util.Hashtable attributes)
This lockable wants to participate in the Virtual Lock table.

Specified by:
lockAttributes in interface org.apache.derby.iapi.services.locks.Lockable