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

public final Class ReclaimSpace

extends Object
implements Serviceable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.daemon.Serviceable
Imports
org.apache.derby.iapi.store.raw.ContainerKey, .RecordHandle, .PageTimeStamp, .PageKey, .ContainerHandle, org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.daemon.Serviceable, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.raw.data.DataFactory

Post commit work to reclaim some space from the raw store. This is a wrapper class for the real serviceable class who wraps this on top of itself so different things can be identified.

Field Summary

Modifier and TypeField and Description
private int
public static final int
private int
private long
private int
public static final int
private ContainerKey
private RecordHandle
public static final int
private PageKey
private DataFactory
private int
public static final int
private boolean
private PageTimeStamp

Constructor Summary

AccessConstructor and Description
public
ReclaimSpace(int reclaim, ContainerKey containerId, DataFactory processor, boolean serviceASAP)

public
ReclaimSpace(int reclaim, PageKey pageId, DataFactory processor, boolean serviceASAP)

public
ReclaimSpace(int reclaim, RecordHandle headRowHandle, DataFactory processor, boolean serviceASAP)

public
ReclaimSpace(int reclaim, RecordHandle headRowHandle, int columnId, long ovPageId, int ovRecordId, PageTimeStamp timeStamp, DataFactory processor, boolean serviceASAP)

Method Summary

Modifier and TypeMethod and Description
public final int
public final long
public final int
public final ContainerKey
public final RecordHandle
public final PageKey
public final PageTimeStamp
public final int
private void
initContainerInfo(ContainerKey containerId, int reclaim, DataFactory processor, boolean serviceASAP)

public int
performWork(ContextManager
the contextManager set up by the DaemonService. There may or may not be the necessary context on it, depending on which other Serviceable object it has done work for.
context
)

Implements org.apache.derby.iapi.services.daemon.Serviceable.performWork.

Do whatever it is that you want the daemon to do for you.

public final int
public boolean
serviceASAP()

Implements org.apache.derby.iapi.services.daemon.Serviceable.serviceASAP.

If this work should be done as soon as possible, then return true.

public boolean
serviceImmediately()

Implements org.apache.derby.iapi.services.daemon.Serviceable.serviceImmediately.

If this work should be done immediately on the user thread then return true.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

attemptsback to summary
private int attempts
COLUMN_CHAINback to summary
public static final int COLUMN_CHAIN
columnIdback to summary
private int columnId
columnPageIdback to summary
private long columnPageId
columnRecordIdback to summary
private int columnRecordId
CONTAINERback to summary
public static final int CONTAINER
containerIdback to summary
private ContainerKey containerId
headRowHandleback to summary
private RecordHandle headRowHandle
PAGEback to summary
public static final int PAGE
pageIdback to summary
private PageKey pageId
processorback to summary
private DataFactory processor
reclaimback to summary
private int reclaim
ROW_RESERVEback to summary
public static final int ROW_RESERVE
serviceASAPback to summary
private boolean serviceASAP
timeStampback to summary
private PageTimeStamp timeStamp

Constructor Detail

ReclaimSpaceback to summary
public ReclaimSpace(int reclaim, ContainerKey containerId, DataFactory processor, boolean serviceASAP)
ReclaimSpaceback to summary
public ReclaimSpace(int reclaim, PageKey pageId, DataFactory processor, boolean serviceASAP)
ReclaimSpaceback to summary
public ReclaimSpace(int reclaim, RecordHandle headRowHandle, DataFactory processor, boolean serviceASAP)
ReclaimSpaceback to summary
public ReclaimSpace(int reclaim, RecordHandle headRowHandle, int columnId, long ovPageId, int ovRecordId, PageTimeStamp timeStamp, DataFactory processor, boolean serviceASAP)

Method Detail

getColumnIdback to summary
public final int getColumnId()
getColumnPageIdback to summary
public final long getColumnPageId()
getColumnRecordIdback to summary
public final int getColumnRecordId()
getContainerIdback to summary
public final ContainerKey getContainerId()
getHeadRowHandleback to summary
public final RecordHandle getHeadRowHandle()
getPageIdback to summary
public final PageKey getPageId()
getPageTimeStampback to summary
public final PageTimeStamp getPageTimeStamp()
incrAttemptsback to summary
public final int incrAttempts()
initContainerInfoback to summary
private void initContainerInfo(ContainerKey containerId, int reclaim, DataFactory processor, boolean serviceASAP)
performWorkback to summary
public int performWork(ContextManager context) throws StandardException

Implements org.apache.derby.iapi.services.daemon.Serviceable.performWork.

Doc from org.apache.derby.iapi.services.daemon.Serviceable.performWork.

Do whatever it is that you want the daemon to do for you. There may be multiple daemon objects on different thread calling performWork at the same time. The DaemonService will always call performWork with a context manager set up. the DaemonService will clean up the context if an exception is thrown. However, it is up to performWork to manage its own transaction. If you start a transaction in performWork, you must commit or abort it at the end. You may leave the transaction open so that other serviceable may use the transaction and context without starting a new one. On the same token, there may already be an opened transaction on the context. Serviceable performWork should always check the state of the context before use. A Serviceable object should be well behaved while it is performing the daemon work, i.e., it should not take too many resources or hog the CPU for too long or deadlock with anyone else.

Parameters
context:ContextManager

the contextManager set up by the DaemonService. There may or may not be the necessary context on it, depending on which other Serviceable object it has done work for.

Returns:int

the return status is only significant if the Serviceable client was enqueued instead of subscribed. For subscribed client, the return status is ignored. For enqueue client, it returns DONE or REQUEUE. If a REQUEUEd is returned, it would be desirable if this should not be serviceASAP, although no harm is done if this still maintains that this should be serviced ASAP ...

Exceptions
StandardException:
Standard Derby exception policy

MT - depends on the work. Be wary of multiple DaemonService thread calling at the same time if you subscribe or enqueue multiple times.

reclaimWhatback to summary
public final int reclaimWhat()
serviceASAPback to summary
public boolean serviceASAP()

Implements org.apache.derby.iapi.services.daemon.Serviceable.serviceASAP.

Doc from org.apache.derby.iapi.services.daemon.Serviceable.serviceASAP.

If this work should be done as soon as possible, then return true. If it doesn't make any difference if it is done sooner rather than later, then return false. The difference is whether or not the daemon service will be notified to work on this when this work is enqueued or subscribed, in case the serviceable work is put together but not sent to the daemon service directly, like in post commit processing

MT - MT safe

Returns:boolean

true if this should work as soon as possible

serviceImmediatelyback to summary
public boolean serviceImmediately()

Implements org.apache.derby.iapi.services.daemon.Serviceable.serviceImmediately.

Doc from org.apache.derby.iapi.services.daemon.Serviceable.serviceImmediately.

If this work should be done immediately on the user thread then return true. If it doesn't make any difference if this work is done on a the user thread immediately or if it is performed by another thread asynchronously later, then return false.

Returns:boolean

true if this work shold happen immediately on the user thread

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