Top Description Fields Constructors Methods
org.apache.derby.impl.store.raw.data

public final Class RecordId

extends Object
implements RecordHandle
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.raw.RecordHandle, org.apache.derby.iapi.services.locks.Lockable
Imports
org.apache.derby.iapi.store.raw.ContainerKey, .PageKey, .RowLock, .RecordHandle, org.apache.derby.iapi.services.locks.Latch, .VirtualLockTable, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.catalog.UUID, java.util.Hashtable

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

Modifier and TypeField and Description
private final PageKey
pageId

Page the record lives in. MT - Immutable

private final int
recordId

The actual record id. MT - Immutable

private transient int
slotNumberHint

Last slot number this record id was at.

Constructor Summary

AccessConstructor and Description
public
RecordId(ContainerKey container, long pageNumber, int recordId)

public
RecordId(PageKey pageId, int recordId)

public
RecordId(PageKey pageId, int recordId, int current_slot)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
ref
)

Overrides java.lang.Object.equals.

Implement value equality.

public ContainerKey
getContainerId()

Implements org.apache.derby.iapi.store.raw.RecordHandle.getContainerId.

Return the identity of my container.

public int
getId()

Implements org.apache.derby.iapi.store.raw.RecordHandle.getId.

Get my record id. MT - thread safe

public Object
getPageId()

Implements org.apache.derby.iapi.store.raw.RecordHandle.getPageId.

Return the identity of my Page.

public long
public int

Returns:

The slot number the record handle may be at.
getSlotNumberHint
()

Implements org.apache.derby.iapi.store.raw.RecordHandle.getSlotNumberHint.

What slot number might the record be at?

public int
hashCode()

Overrides java.lang.Object.hashCode.

Return a hashcode based on value.

public boolean
lockAttributes(int
use the bits in this int to decide if the user is interested in this kind of lockable object. The bits are defined in VirtualLockTable. For instance, the user may only ask for TABLE_AND_ROWLOCK and if this is not a table or row lock, then don't participate.
flag
,
Hashtable<String, Object>
if this decides to participate, put all relevant attributes into the Hashtable. The complete list of interesting attributes is listed in VirtualLockTable. The following attributes must be present for all participating lockables: VirtualLockTable.LOCKNAME, VirtualLockTable.LOCKTYPE, either VirtualLockTable.CONTAINERID or VirtualLockTable.CONGLOMID,

MT - this routine must be MP safe, caller will not be single threading the lock manager.

attributes
)

Implements org.apache.derby.iapi.services.locks.Lockable.lockAttributes.

This lockable wants to participate in the Virtual Lock table.

public boolean
lockerAlwaysCompatible()

Implements org.apache.derby.iapi.services.locks.Lockable.lockerAlwaysCompatible.

Is a caller that holds a lock compatible with themselves?

public void
lockEvent(Latch
Latch descriptor
lockInfo
)

Implements org.apache.derby.iapi.services.locks.Lockable.lockEvent.

Lock me.

public boolean
requestCompatible(Object
The desired qualifier
requestedQualifier
,
Object
The already granted qualifier
grantedQualifier
)

Implements org.apache.derby.iapi.services.locks.Lockable.requestCompatible.

Determine if this request can be granted.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
unlockEvent(Latch
Latch descriptor
lockInfo
)

Implements org.apache.derby.iapi.services.locks.Lockable.unlockEvent.

Unlock me.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

pageIdback to summary
private final PageKey pageId

Page the record lives in. MT - Immutable

recordIdback to summary
private final int recordId

The actual record id. MT - Immutable

slotNumberHintback to summary
private transient int slotNumberHint

Last slot number this record id was at.

Constructor Detail

RecordIdback to summary
public RecordId(ContainerKey container, long pageNumber, int recordId)
RecordIdback to summary
public RecordId(PageKey pageId, int recordId)
RecordIdback to summary
public RecordId(PageKey pageId, int recordId, int current_slot)

Method Detail

equalsback to summary
public boolean equals(Object ref)

Overrides java.lang.Object.equals.

Implement value equality.
MT - Thread safe

Parameters
ref:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

getContainerIdback to summary
public ContainerKey getContainerId()

Implements org.apache.derby.iapi.store.raw.RecordHandle.getContainerId.

Doc from org.apache.derby.iapi.store.raw.RecordHandle.getContainerId.

Return the identity of my container.

getIdback to summary
public int getId()

Implements org.apache.derby.iapi.store.raw.RecordHandle.getId.

Get my record id.
MT - thread safe

See Also
RecordHandle#getId
getPageIdback to summary
public Object getPageId()

Implements org.apache.derby.iapi.store.raw.RecordHandle.getPageId.

Doc from org.apache.derby.iapi.store.raw.RecordHandle.getPageId.

Return the identity of my Page.

getPageNumberback to summary
public long getPageNumber()

Implements org.apache.derby.iapi.store.raw.RecordHandle.getPageNumber.

Get my page number.
MT - thread safe

See Also
RecordHandle#getPageNumber
getSlotNumberHintback to summary
public int getSlotNumberHint()

Implements org.apache.derby.iapi.store.raw.RecordHandle.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.

Returns:int

The slot number the record handle may be at.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Return a hashcode based on value.
MT - thread safe

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

lockAttributesback to summary
public boolean lockAttributes(int flag, Hashtable<String, Object> attributes)

Implements org.apache.derby.iapi.services.locks.Lockable.lockAttributes.

This lockable wants to participate in the Virtual Lock table.

Parameters
flag:int

Doc from org.apache.derby.iapi.services.locks.Lockable.lockAttributes.

use the bits in this int to decide if the user is interested in this kind of lockable object. The bits are defined in VirtualLockTable. For instance, the user may only ask for TABLE_AND_ROWLOCK and if this is not a table or row lock, then don't participate.

attributes:Hashtable<String, Object>

Doc from org.apache.derby.iapi.services.locks.Lockable.lockAttributes.

if this decides to participate, put all relevant attributes into the Hashtable. The complete list of interesting attributes is listed in VirtualLockTable. The following attributes must be present for all participating lockables: VirtualLockTable.LOCKNAME, VirtualLockTable.LOCKTYPE, either VirtualLockTable.CONTAINERID or VirtualLockTable.CONGLOMID,

MT - this routine must be MP safe, caller will not be single threading the lock manager.

Returns:boolean

Doc from org.apache.derby.iapi.services.locks.Lockable.lockAttributes.

true if this object has diagnostic information to add to the virtual lock table. If this object either does not want to participate in the diagnostic virtual lock table or none of the attributes requested are attributes of this lock, returns false.

lockerAlwaysCompatibleback to summary
public boolean lockerAlwaysCompatible()

Implements org.apache.derby.iapi.services.locks.Lockable.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)

Returns:boolean

Doc from org.apache.derby.iapi.services.locks.Lockable.lockerAlwaysCompatible.

if any lock request is allowed

See Also
org.apache.derby.iapi.services.locks.Lockable#lockerAlwaysCompatible
lockEventback to summary
public void lockEvent(Latch lockInfo)

Implements org.apache.derby.iapi.services.locks.Lockable.lockEvent.

Lock me.
MT - Single thread required (methods of Lockable)

Parameters
lockInfo:Latch

Doc from org.apache.derby.iapi.services.locks.Lockable.lockEvent.

Latch descriptor

See Also
org.apache.derby.iapi.services.locks.Lockable#lockEvent
requestCompatibleback to summary
public boolean requestCompatible(Object requestedQualifier, Object grantedQualifier)

Implements org.apache.derby.iapi.services.locks.Lockable.requestCompatible.

Determine if this request can be granted.

Implements the grant/wait lock logic for row locks. See the table in RowLock for more information.
MT - Single thread required (methods of Lockable)

Parameters
requestedQualifier:Object

Doc from org.apache.derby.iapi.services.locks.Lockable.requestCompatible.

The desired qualifier

grantedQualifier:Object

Doc from org.apache.derby.iapi.services.locks.Lockable.requestCompatible.

The already granted qualifier

Returns:boolean

Doc from org.apache.derby.iapi.services.locks.Lockable.requestCompatible.

true if the request is compatible

See Also
org.apache.derby.iapi.services.locks.Lockable#requestCompatible
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

unlockEventback to summary
public void unlockEvent(Latch lockInfo)

Implements org.apache.derby.iapi.services.locks.Lockable.unlockEvent.

Unlock me.
MT - Single thread required (methods of Lockable)

Parameters
lockInfo:Latch

Doc from org.apache.derby.iapi.services.locks.Lockable.unlockEvent.

Latch descriptor

See Also
org.apache.derby.iapi.services.locks.Lockable#unlockEvent