Class ReclaimSpace
java.lang.Object
org.apache.derby.impl.store.raw.data.ReclaimSpace
- All Implemented Interfaces:
Serviceable
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
FieldsModifier and TypeFieldDescriptionprivate intstatic final intprivate intprivate longprivate intstatic final intprivate ContainerKeyprivate RecordHandlestatic final intprivate PageKeyprivate DataFactoryprivate intstatic final intprivate booleanprivate PageTimeStampFields inherited from interface Serviceable
DONE, REQUEUE -
Constructor Summary
ConstructorsConstructorDescriptionReclaimSpace(int reclaim, ContainerKey containerId, DataFactory processor, boolean serviceASAP) ReclaimSpace(int reclaim, PageKey pageId, DataFactory processor, boolean serviceASAP) ReclaimSpace(int reclaim, RecordHandle headRowHandle, int columnId, long ovPageId, int ovRecordId, PageTimeStamp timeStamp, DataFactory processor, boolean serviceASAP) ReclaimSpace(int reclaim, RecordHandle headRowHandle, DataFactory processor, boolean serviceASAP) -
Method Summary
Modifier and TypeMethodDescriptionfinal intfinal longfinal intfinal ContainerKeyfinal RecordHandlefinal PageKeyfinal PageTimeStampfinal intprivate voidinitContainerInfo(ContainerKey containerId, int reclaim, DataFactory processor, boolean serviceASAP) intperformWork(ContextManager context) Do whatever it is that you want the daemon to do for you.final intbooleanIf this work should be done as soon as possible, then return true.booleanIf this work should be done immediately on the user thread then return true.toString()
-
Field Details
-
serviceASAP
private boolean serviceASAP -
containerId
-
pageId
-
headRowHandle
-
columnId
private int columnId -
columnPageId
private long columnPageId -
columnRecordId
private int columnRecordId -
timeStamp
-
attempts
private int attempts -
processor
-
reclaim
private int reclaim -
CONTAINER
public static final int CONTAINER- See Also:
-
PAGE
public static final int PAGE- See Also:
-
ROW_RESERVE
public static final int ROW_RESERVE- See Also:
-
COLUMN_CHAIN
public static final int COLUMN_CHAIN- See Also:
-
-
Constructor Details
-
ReclaimSpace
public ReclaimSpace(int reclaim, ContainerKey containerId, DataFactory processor, boolean serviceASAP) -
ReclaimSpace
-
ReclaimSpace
public ReclaimSpace(int reclaim, RecordHandle headRowHandle, DataFactory processor, boolean serviceASAP) -
ReclaimSpace
public ReclaimSpace(int reclaim, RecordHandle headRowHandle, int columnId, long ovPageId, int ovRecordId, PageTimeStamp timeStamp, DataFactory processor, boolean serviceASAP)
-
-
Method Details
-
initContainerInfo
private void initContainerInfo(ContainerKey containerId, int reclaim, DataFactory processor, boolean serviceASAP) -
serviceASAP
public boolean serviceASAP()Description copied from interface:ServiceableIf 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 processingMT - MT safe
- Specified by:
serviceASAPin interfaceServiceable
-
performWork
Description copied from interface:ServiceableDo 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.- Specified by:
performWorkin interfaceServiceable- Parameters:
context- 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:
- 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 ...
- Throws:
StandardException- Standard Derby exception policyMT - depends on the work. Be wary of multiple DaemonService thread calling at the same time if you subscribe or enqueue multiple times.
-
serviceImmediately
public boolean serviceImmediately()Description copied from interface:ServiceableIf 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.- Specified by:
serviceImmediatelyin interfaceServiceable
-
getContainerId
-
getPageId
-
getHeadRowHandle
-
getColumnId
public final int getColumnId() -
getColumnPageId
public final long getColumnPageId() -
getColumnRecordId
public final int getColumnRecordId() -
getPageTimeStamp
-
reclaimWhat
public final int reclaimWhat() -
incrAttempts
public final int incrAttempts() -
toString
-