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

public Class BaseContainerHandle

extends DerbyObservable
implements RawContainerHandle, DerbyObserver
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.monitor.DerbyObserver, org.apache.derby.iapi.store.raw.data.RawContainerHandle, org.apache.derby.iapi.store.raw.ContainerHandle
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.locks.Lockable, .VirtualLockTable, org.apache.derby.iapi.services.monitor.DerbyObservable, .DerbyObserver, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.access.SpaceInfo, org.apache.derby.iapi.store.raw.ContainerHandle, .ContainerLock, .LockingPolicy, .Page, .PageKey, .PageTimeStamp, .RecordHandle, .ContainerKey, org.apache.derby.iapi.store.raw.data.RawContainerHandle, org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.iapi.store.raw.log.LogInstant, org.apache.derby.iapi.util.ByteArray, org.apache.derby.catalog.UUID, java.util.Hashtable, .Properties

A handle to an open container, implememts RawContainerHandle.

This class is a DerbyObserver to observe RawTransactions and is also a DerbyObservable to handle the list of pages accessed thorough this handle.
This class implements Lockable (defined to be ContainerHandle) and is the object used to logically lock the container.
MT - Mutable - Immutable identity - Thread Aware

Field Summary

Modifier and TypeField and Description
private PageActions
private boolean
active

Is this ContainerHandle active.

private AllocationActions
protected BaseContainer
container

The actual container we are accessing.

private boolean
forUpdate

are we going to update?

private ContainerKey
identity

Container identifier MT - Immutable

private LockingPolicy
locking

the locking policy we opened the container with.

private int
mode

mode the conainter was opened in.

private RawTransaction
xact

our transaction.

Constructor Summary

AccessConstructor and Description
public
BaseContainerHandle(UUID rawStoreId, RawTransaction xact, ContainerKey identity, LockingPolicy locking, int mode)

Create an object that is only used for locking the container.

public
BaseContainerHandle(UUID rawStoreId, RawTransaction xact, PageActions actionsSet, AllocationActions allocActionsSet, LockingPolicy locking, BaseContainer container, int mode)

Create a container handle that is used to actually access the container.

Method Summary

Modifier and TypeMethod and Description
public Page
addPage()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.addPage.

Add a page to the container The page returned will be observing me.

public Page
addPage(int flag)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.addPage.

Add a page to the container, if flag == ContainerHandle.ADD_PAGE_BULK, tell the container about it.

public void
backupContainer(String
location of the backup container.
backupContainerPath
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.backupContainer.

Backup the container to the specified path.

protected void
private void
public synchronized void
public void
compactRecord(RecordHandle
The record handle, the record must have been locked execlusively already.
record
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.compactRecord.

This record probably has shrunk considerably.

public void
public void
dropContainer(LogInstant instant, boolean drop)

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.dropContainer.

If drop is true, drop the container.

public void
encryptOrDecryptContainer(String
file to store the new version of the container
newFilePath
,
boolean
tells whether to encrypt or decrypt
doEncrypt
)

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.encryptOrDecryptContainer.

Creates an encrypted or decrypted version of the container.

public void
flushContainer()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.flushContainer.

Flush all dirty pages of the container to disk.

public PageActions
public AllocationActions
public Page
getAllocPage(long pageNumber)

public Page
getAnyPage(long pageNumber)

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.getAnyPage.

Get this page with no check - any page type or status is fine.

public void
getContainerProperties(Properties
Property list to fill in.
prop
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getContainerProperties.

Request the system properties associated with a container.

public int
public long
public long
getEstimatedPageCount(int
different flavors of page count (reserved for future use)
flag
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getEstimatedPageCount.

Get the total estimated number of allocated (not freed, not deallocated) user pages in the container, including overflow pages.

public long
getEstimatedRowCount(int
different flavors of row count (reserved for future use)
flag
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getEstimatedRowCount.

Get the total estimated number of rows in the container, not including overflow rows.

public Page
getFirstPage()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getFirstPage.

Obtain exclusive access to the current first page of the container.

public ContainerKey
public final LockingPolicy
getLockingPolicy()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getLockingPolicy.

Return my locking policy, may be different from the Transaction's default locking policy.

public int
getMode()

Get the mode I was opened with.

public Page
getNextPage(long
the pagenumber of the page previous to the page that is to be gotten. The page which correspond to prevNum may or may not be latched by the caller, but it must be gotten via a page which was (or currently still is) latched, and the page number must be gotten while the container must not have been closed or dropped or removed in the interim. In other words, if the user manufactures a page number, or remembers the page number from a previous session or a previous openContainer, then the behavior of this routine is undefined.
pageNumber
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getNextPage.

Obtain exclusive access to the next valid page of the given page number in the container.

public Page
getPage(long pageNumber)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getPage.

Obtain exclusive access to the page with the given page number.

public Page
public Page
getPageForInsert(int
a GET_PAGE_* flag.
flag
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getPageForInsert.

Get a page for insert.

public Page
getPageNoWait(long pageNumber)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getPageNoWait.

Identical to getPage but returns null immediately if the desired page is already latched by another Container.

public long

Returns:

version sequence number
getReusableRecordIdSequenceNumber
()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getReusableRecordIdSequenceNumber.

Get the reusable recordId sequence number.

public SpaceInfo
getSpaceInfo()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getSpaceInfo.

Get information about space used by the container.

public final RawTransaction
getTransaction()

Return the RawTransaction I was opened in.

public Object
getUniqueId()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getUniqueId.

Return my unique identifier, this identifier will be unique to each instance of an open container handle.

public Page
getUserPageNoWait(long pageNumber)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getUserPageNoWait.

Obtain exclusive access to the page with the given page number.

public Page
getUserPageWait(long pageNumber)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getUserPageWait.

Obtain exclusive access to the page with the given page number.

protected void
public final boolean
isReadOnly()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.isReadOnly.

Is the container opened for read only or update?

public boolean
isTemporaryContainer()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.isTemporaryContainer.

Return true if this containerHandle refers to a temporary container.

public ByteArray
logCreateContainerInfo()

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.logCreateContainerInfo.

Log all information necessary to recreate the container during a load tran.

public RecordHandle
makeRecordHandle(long
the page number of the RecordHandle.
pageNumber
,
int
the record id of the RecordHandle.
recordId
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.makeRecordHandle.

Return a record handle that is initialized to the given page number and record id.

public void
preAllocate(int numPage)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.preAllocate.

Preallocate numPage if possible.

public void
preDirty(boolean preDirtyOn)

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.preDirty.

The container is about to be modified.

public Page
reCreatePageForRedoRecovery(int pageFormat, long pageNumber, long pageOffset)

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.reCreatePageForRedoRecovery.

ReCreate a page for rollforward recovery.

public void
public void
removePage(Page page)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.removePage.

Remove a page from the container.

public void
setEstimatedRowCount(long
the estimated number of rows in the container.
count
,
int
different flavors of row count (reserved for future use)
flag
)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.setEstimatedRowCount.

Set the total estimated number of rows in the container.

public final void
setLockingPolicy(LockingPolicy newLockingPolicy)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.setLockingPolicy.

Set the locking policy for this open container

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
update(DerbyObservable
The object which is being observed
obj
,
Object
Extra information being passed to the callback
arg
)

Implements org.apache.derby.iapi.services.monitor.DerbyObserver.update.

Called when the transaction is about to complete.

public final boolean
updateOK()

Was I opened for updates?

public boolean
useContainer(boolean
if true, use this container even if it is dropped, otherwise, return false if container is dropped.
droppedOK
,
boolean
if true, wait on lock, otherwise, get lock no wait.
waitForLock
)

Attach me to a container.

Inherited from org.apache.derby.iapi.services.monitor.DerbyObservable:
addObservercountObserversdeleteObservernotifyObserversnotifyObserverssetChanged

Field Detail

actionsSetback to summary
private PageActions actionsSet
activeback to summary
private boolean active

Is this ContainerHandle active.
MT - Mutable : scoped

allocActionsSetback to summary
private AllocationActions allocActionsSet
containerback to summary
protected BaseContainer container

The actual container we are accessing. Only valid when active is true.
MT - Mutable : scoped

forUpdateback to summary
private boolean forUpdate

are we going to update?
MT - Immutable after container handle becomes active

identityback to summary
private ContainerKey identity

Container identifier
MT - Immutable

lockingback to summary
private LockingPolicy locking

the locking policy we opened the container with. Only valid when active is true.
MT - Mutable : scoped

modeback to summary
private int mode

mode the conainter was opened in.

xactback to summary
private RawTransaction xact

our transaction. Only valid when active is true.
MT - Mutable : scoped

Constructor Detail

BaseContainerHandleback to summary
public BaseContainerHandle(UUID rawStoreId, RawTransaction xact, ContainerKey identity, LockingPolicy locking, int mode)

Create an object that is only used for locking the container.

BaseContainerHandleback to summary
public BaseContainerHandle(UUID rawStoreId, RawTransaction xact, PageActions actionsSet, AllocationActions allocActionsSet, LockingPolicy locking, BaseContainer container, int mode)

Create a container handle that is used to actually access the container.

Method Detail

addPageback to summary
public Page addPage() throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.addPage.

Add a page to the container The page returned will be observing me.

Returns:Page

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.addPage.

a reference to the page that was added.

Exceptions
StandardException:
Standard Derby error policy
See Also
BaseContainer#addPage, ContainerHandle#addPage
addPageback to summary
public Page addPage(int flag) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.addPage.

Add a page to the container, if flag == ContainerHandle.ADD_PAGE_BULK, tell the container about it. The page returned will be observing me.

Returns:Page

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.addPage.

a reference to the page that was added.

Exceptions
StandardException:
Standard Derby error policy
See Also
BaseContainer#addPage, ContainerHandle#addPage
backupContainerback to summary
public void backupContainer(String backupContainerPath) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.backupContainer.

Backup the container to the specified path.

Parameters
backupContainerPath:String

location of the backup container.

Exceptions
StandardException:
Standard Derby error policy
checkOpenback to summary
protected void checkOpen() throws StandardException
checkUpdateOpenback to summary
private void checkUpdateOpen() throws StandardException
closeback to summary
public synchronized void close()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.close.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.close.

Close me. After using this method the caller must throw away the reference to the Container object, e.g.

	ref.close();
	ref = null;

The container will be closed automatically at the commit or abort of the transaction if this method is not called explictly.
Any pages that were obtained using me and have not been released using Page's unlatch method are released, and references to them must be thrown away.
See Also
ContainerHandle#close
compactRecordback to summary
public void compactRecord(RecordHandle record) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.compactRecord.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.compactRecord.

This record probably has shrunk considerably. Free its reserved space or compact it.

Parameters
record:RecordHandle

The record handle, the record must have been locked execlusively already.

Exceptions
StandardException:
Standard Derby error policy
See Also
ContainerHandle#compactRecord
compressContainerback to summary
public void compressContainer() throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.compressContainer.

Release free space to the OS.

As is possible release any free space to the operating system. This will usually mean releasing any free pages located at the end of the file using the java truncate() interface.

Exceptions
StandardException:
Standard Derby error policy
dropContainerback to summary
public void dropContainer(LogInstant instant, boolean drop) throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.dropContainer.

Doc from org.apache.derby.iapi.store.raw.data.RawContainerHandle.dropContainer.

If drop is true, drop the container. if drop is false, un-drop the container

Exceptions
StandardException:
Standard Derby exception policy
See Also
RawContainerHandle#dropContainer
encryptOrDecryptContainerback to summary
public void encryptOrDecryptContainer(String newFilePath, boolean doEncrypt) throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.encryptOrDecryptContainer.

Doc from org.apache.derby.iapi.store.raw.data.RawContainerHandle.encryptOrDecryptContainer.

Creates an encrypted or decrypted version of the container.

Parameters
newFilePath:String

file to store the new version of the container

doEncrypt:boolean

tells whether to encrypt or decrypt

Exceptions
StandardException:
Standard Derby error policy
flushContainerback to summary
public void flushContainer() throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.flushContainer.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.flushContainer.

Flush all dirty pages of the container to disk. Used mainly for UNLOGGED or CREATE_UNLOGGED operation.

Exceptions
StandardException:
Standard Derby error policy
See Also
ContainerHandle#flushContainer
getActionSetback to summary
public PageActions getActionSet()
getAllocationActionSetback to summary
public AllocationActions getAllocationActionSet()
getAllocPageback to summary
public Page getAllocPage(long pageNumber) throws StandardException
getAnyPageback to summary
public Page getAnyPage(long pageNumber) throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.getAnyPage.

Get this page with no check - any page type or status is fine. Caller must be prepared to handle freed, deallocated,or alloc page Called by recovery ONLY.

Exceptions
StandardException:
Derby Standard error policy
getContainerPropertiesback to summary
public void getContainerProperties(Properties prop) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getContainerProperties.

Request the system properties associated with a container.

Request the value of properties that are associated with a container. The following properties can be requested: derby.storage.pageSize derby.storage.pageReservedSpace derby.storage.minimumRecordSize

To get the value of a particular property add it to the property list, and on return the value of the property will be set to it's current value. For example: get_prop(BaseContainerHandle ch) { Properties prop = new Properties(); prop.put("derby.storage.pageSize", ""); ch.getContainerProperties(prop); System.out.println( "conatainer's page size = " + prop.getProperty("derby.storage.pageSize"); }

Parameters
prop:Properties

Property list to fill in.

Exceptions
StandardException:
Standard exception policy.
getContainerStatusback to summary
public int getContainerStatus() throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.getContainerStatus.

Get the container status.

Exceptions
StandardException:
Standard Derby error policy
See Also
RawContainerHandle#getContainerStatus
getContainerVersionback to summary
public long getContainerVersion() throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.getContainerVersion.

Doc from org.apache.derby.iapi.store.raw.data.RawContainerHandle.getContainerVersion.

Get the logged container version

Exceptions
StandardException:
Standard Derby exception policy
See Also
RawContainerHandle#getContainerVersion
getEstimatedPageCountback to summary
public long getEstimatedPageCount(int flag) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getEstimatedPageCount.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getEstimatedPageCount.

Get the total estimated number of allocated (not freed, not deallocated) user pages in the container, including overflow pages. this number is a rough estimate and may be grossly off.

Parameters
flag:int

different flavors of page count (reserved for future use)

Exceptions
StandardException:
Standard Derby error policy
See Also
ContainerHandle#getEstimatedPageCount
getEstimatedRowCountback to summary
public long getEstimatedRowCount(int flag) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getEstimatedRowCount.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getEstimatedRowCount.

Get the total estimated number of rows in the container, not including overflow rows. This number is a rough estimate and may be grossly off.

Parameters
flag:int

different flavors of row count (reserved for future use)

Exceptions
StandardException:
Standard Derby error policy
See Also
ContainerHandle#getEstimatedRowCount
getFirstPageback to summary
public Page getFirstPage() throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getFirstPage.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getFirstPage.

Obtain exclusive access to the current first page of the container. Only a valid, non overflow page will be returned. Pages in the container are ordered in an internally defined ordering.

Note that once this method returns this page may no longer be the first page of the container. I.e, other threads may allocate pages prior to this page number while this page is latched. It is up to the caller of this routine to synchronize this call with addPage to assure that this is the first page.
As long as the client provide the necessary lock to ensure that no addPage is called, then this page is guaranteed to be the first page of the container in some internally defined ordering of the pages.

Returns:Page

latched page or null if there is no page in the container

Exceptions
StandardException:
Standard Derby error policy
getIdback to summary
public ContainerKey getId()

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

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getId.

Return my identifier.

See Also
ContainerHandle#getId
getLockingPolicyback to summary
public final LockingPolicy getLockingPolicy()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getLockingPolicy.

Return my locking policy, may be different from the Transaction's default locking policy.

getModeback to summary
public int getMode()

Get the mode I was opened with.

getNextPageback to summary
public Page getNextPage(long pageNumber) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getNextPage.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getNextPage.

Obtain exclusive access to the next valid page of the given page number in the container. Only a valid, non overflow page will be returned. Pages in the container are ordered in an internally defined ordering.

Note that once this method returns this page may no longer be the next page of the container. I.e, other threads may allocate pages prior to this page number while this page is latched. It is up to the caller of this routine to synchronize this call with addPage to assure that this is the first page.
As long as the client provide the necessary lock to ensure that no addPage is called, then this page is guaranteed to be the next page of the container in some internally defined ordering of the pages.
If no pages are added or removed, then an iteration such as:

for (Page p = containerHandle.getFirstPage();
	 p != null;
	 p = containerHandle.getNextPage(p.getPageNumber()))
will guarentee to iterate thru and latched all the valid pages in the container
Parameters
pageNumber:long

the pagenumber of the page previous to the page that is to be gotten. The page which correspond to prevNum may or may not be latched by the caller, but it must be gotten via a page which was (or currently still is) latched, and the page number must be gotten while the container must not have been closed or dropped or removed in the interim. In other words, if the user manufactures a page number, or remembers the page number from a previous session or a previous openContainer, then the behavior of this routine is undefined.

Returns:Page

latched page or null if there is no next page in the container

Exceptions
StandardException:
Standard Derby error policy
getPageback to summary
public Page getPage(long pageNumber) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getPage.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getPage.

Obtain exclusive access to the page with the given page number. Once the Page is no longer required the Page's unlatch() method must be called.

The Page object is guaranteed to remain in-memory and exclusive to the caller until its unlatch() method is called.

Returns:Page

the required Page or null if the page does not exist or is not valid (i.e, it has been deallocated or freed or never initialized) Note that an overflow page will be returned since it is a valid page.

Exceptions
StandardException:
Standard Derby error policy
getPageForCompressback to summary
public Page getPageForCompress(int flag, long pageno) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getPageForCompress.

getPageForInsertback to summary
public Page getPageForInsert(int flag) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getPageForInsert.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getPageForInsert.

Get a page for insert. If RawStore thinks it knows where a potentially suitable page is for insert, it will return it. If RawStore doesn't know where a suitable page for insert is, or if there are no allocated page, then null is returned. If a page is returned, it will be a valid, non-overflow page. A potentially suitable page is one which has enough space for a minium sized record.

Parameters
flag:int

a GET_PAGE_* flag.

Returns:Page

a valid, non-overflow page. Or null if RawStore doesn't know where to find a good valid, non-overflow page.

Exceptions
StandardException:
Standard Derby error policy
getPageNoWaitback to summary
public Page getPageNoWait(long pageNumber) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getPageNoWait.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getPageNoWait.

Identical to getPage but returns null immediately if the desired page is already latched by another Container.

Returns:Page

the required Page or null if the page does not exist or the page is already latched.

Exceptions
StandardException:
Standard Derby error policy
getReusableRecordIdSequenceNumberback to summary
public long getReusableRecordIdSequenceNumber() throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getReusableRecordIdSequenceNumber.

Get the reusable recordId sequence number.

Returns:long

version sequence number

Exceptions
StandardException:
Standard Derby error policy
See Also
ContainerHandle#getReusableRecordIdSequenceNumber
getSpaceInfoback to summary
public SpaceInfo getSpaceInfo() throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getSpaceInfo.

Get information about space used by the container.

getTransactionback to summary
public final RawTransaction getTransaction()

Return the RawTransaction I was opened in.

getUniqueIdback to summary
public Object getUniqueId()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getUniqueId.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getUniqueId.

Return my unique identifier, this identifier will be unique to each instance of an open container handle. This id is used by the locking system to group locks to an open container handle.

See Also
ContainerHandle#getUniqueId
getUserPageNoWaitback to summary
public Page getUserPageNoWait(long pageNumber) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getUserPageNoWait.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getUserPageNoWait.

Obtain exclusive access to the page with the given page number. Will only return a valid, non-overflow user page - so can be used by routines in post commit to get pages to attempt deleted row space reclamation. If for some reason a request is made for an overflow page a null will be returned. Once the Page is no longer required the Page's unlatch() method must be called.

The Page object is guaranteed to remain in-memory and exclusive to the caller until its unlatch() method is called.

Returns:Page

the required Page or null if the page does not exist or is not valid (i.e, it has been deallocated, freed, never initialized, or is an allocation page or overflow page)

Exceptions
StandardException:
Standard Derby error policy
getUserPageWaitback to summary
public Page getUserPageWait(long pageNumber) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.getUserPageWait.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.getUserPageWait.

Obtain exclusive access to the page with the given page number. Will only return a valid, non-overflow user page - so can be used by routines in post commit to get pages to attempt deleted row space reclamation. If for some reason a request is made for an overflow page a null will be returned. Once the Page is no longer required the Page's unlatch() method must be called.

The Page object is guaranteed to remain in-memory and exclusive to the caller until its unlatch() method is called.

Returns:Page

the required Page or null if the page does not exist or is not valid (i.e, it has been deallocated, freed, never initialized, or is an allocation page or overflow page)

Exceptions
StandardException:
Standard Derby error policy
informObserversback to summary
protected void informObservers()
isReadOnlyback to summary
public final boolean isReadOnly()

Implements org.apache.derby.iapi.store.raw.ContainerHandle.isReadOnly.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.isReadOnly.

Is the container opened for read only or update?

Returns:boolean

true if container is opened for read only, else false.

See Also
ContainerHandle#isReadOnly()
isTemporaryContainerback to summary
public boolean isTemporaryContainer() throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.isTemporaryContainer.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.isTemporaryContainer.

Return true if this containerHandle refers to a temporary container.

Exceptions
StandardException:
Standard Derby error policy
See Also
ContainerHandle#isTemporaryContainer
logCreateContainerInfoback to summary
public ByteArray logCreateContainerInfo() throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.logCreateContainerInfo.

Log all information necessary to recreate the container during a load tran.

Exceptions
StandardException:
Standard Derby error policy
makeRecordHandleback to summary
public RecordHandle makeRecordHandle(long pageNumber, int recordId) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.makeRecordHandle.

Return a record handle that is initialized to the given page number and record id.

Parameters
pageNumber:long

the page number of the RecordHandle.

recordId:int

the record id of the RecordHandle.

Exceptions
StandardException:
Standard Derby exception policy.
See Also
RecordHandle
preAllocateback to summary
public void preAllocate(int numPage)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.preAllocate.

Preallocate numPage if possible.

preDirtyback to summary
public void preDirty(boolean preDirtyOn) throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.preDirty.

The container is about to be modified. Loggable actions use this to make sure the container gets cleaned if a checkpoint is taken after any log record is sent to the log stream but before the container is actually dirtied.

Exceptions
StandardException:
Standard Derby error policy
reCreatePageForRedoRecoveryback to summary
public Page reCreatePageForRedoRecovery(int pageFormat, long pageNumber, long pageOffset) throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.reCreatePageForRedoRecovery.

ReCreate a page for rollforward recovery.

During redo recovery it is possible for the system to try to redo the creation of a page (ie. going from non-existence to version 0). It first trys to read the page from disk, but a few different types of errors can occur: o the page does not exist at all on disk, this can happen during rollforward recovery applied to a backup where the file was copied and the page was added to the file during the time frame of the backup but after the physical file was copied. o space in the file exists, but it was never initalized. This can happen if you happen to crash at just the right moment during the allocation process. Also on some OS's it is possible to read from a part of the file that was not ever written - resulting in garbage from the store's point of view (often the result is all 0's). All these errors are easy to recover from as the system can easily create a version 0 from scratch and write it to disk. Because the system does not sync allocation of data pages, it is also possible at this point that whlie writing the version 0 to disk to create it we may encounter an out of disk space error (caught in this routine as a StandardException from the create() call. We can't recovery from this without help from outside, so the caught exception is nested and a new exception thrown which the recovery system will output to the user asking them to check their disk for space/errors.

Exceptions
StandardException:
Standard exception policy.
removeContainerback to summary
public void removeContainer(LogInstant instant) throws StandardException

Implements org.apache.derby.iapi.store.raw.data.RawContainerHandle.removeContainer.

remove the container

Exceptions
StandardException:
Standard Derby error policy
See Also
RawContainerHandle#removeContainer
removePageback to summary
public void removePage(Page page) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.removePage.

Remove a page from the container.

Exceptions
StandardException:
Standard Derby error policy
See Also
ContainerHandle#removePage
setEstimatedRowCountback to summary
public void setEstimatedRowCount(long count, int flag) throws StandardException

Implements org.apache.derby.iapi.store.raw.ContainerHandle.setEstimatedRowCount.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.setEstimatedRowCount.

Set the total estimated number of rows in the container. Often, after a scan, the client of RawStore has a much better estimate of the number of rows in the container then what RawStore has. Use this better number for future reference.
It is OK for a ReadOnly ContainerHandle to set the estimated row count.

Parameters
count:long

the estimated number of rows in the container.

flag:int

different flavors of row count (reserved for future use)

Exceptions
StandardException:
Standard Derby error policy
See Also
ContainerHandle#setEstimatedRowCount
setLockingPolicyback to summary
public final void setLockingPolicy(LockingPolicy newLockingPolicy)

Implements org.apache.derby.iapi.store.raw.ContainerHandle.setLockingPolicy.

Doc from org.apache.derby.iapi.store.raw.ContainerHandle.setLockingPolicy.

Set the locking policy for this open container

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

updateback to summary
public void update(DerbyObservable obj, Object arg)

Implements org.apache.derby.iapi.services.monitor.DerbyObserver.update.

Called when the transaction is about to complete.

Parameters
obj:DerbyObservable

Doc from org.apache.derby.iapi.services.monitor.DerbyObserver.update.

The object which is being observed

arg:Object

Doc from org.apache.derby.iapi.services.monitor.DerbyObserver.update.

Extra information being passed to the callback

See Also
DerbyObserver#update
updateOKback to summary
public final boolean updateOK()

Was I opened for updates?


MT - thread safe

useContainerback to summary
public boolean useContainer(boolean droppedOK, boolean waitForLock) throws StandardException

Attach me to a container. If this method returns false then I cannot be used anymore, and any reference to me must be discarded.

Parameters
droppedOK:boolean

if true, use this container even if it is dropped, otherwise, return false if container is dropped.

waitForLock:boolean

if true, wait on lock, otherwise, get lock no wait.

Exceptions
StandardException:
Standard Derby error policy