Class TempRAFContainer
- All Implemented Interfaces:
PrivilegedExceptionAction<Object>, Cacheable, TypedFormat, Lockable
-
Field Summary
FieldsFields inherited from class RAFContainer
fileData, needsSyncFields inherited from class FileContainer
allocCache, canUpdate, CHECKSUM_SIZE, CONTAINER_INFO_SIZE, containerCache, containerInfo, containerVersion, dataFactory, estimatedRowCount, FIRST_ALLOC_PAGE_NUMBER, FIRST_ALLOC_PAGE_OFFSET, firstAllocPageNumber, firstAllocPageOffset, formatIdInteger, initialPages, isDirty, lastLogInstant, minimumRecordSize, pageCache, pageSize, preDirty, SPACE_TRACE, spareSpaceFields inherited from class BaseContainer
identity, isCommittedDrop, isDropped, isReusableRecordId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPage(BaseContainerHandle handle, boolean isOverflow) Add a page without locking the container, only one user will be accessing this table at a time.createIdentity(Object key, Object createParameter) Create a new item.(package private) StorageFilegetFileName(ContainerKey identity, boolean stub, boolean errorOK, boolean tryAlternatePath) booleanReturns true if only a single handle is connected to this container.protected voidletGo(BaseContainerHandle handle) Discontinue use of this container.protected intpreAllocate(long lastPreallocPagenum, int preAllocSize) Preallocate page.protected StorageFileprivGetFileName(ContainerKey identity, boolean stub, boolean errorOK, boolean tryAlternatePath) voidremoveContainer(LogInstant instant, boolean leaveStub) Remove the containersetIdentity(Object key) Open the container.voidtruncate(BaseContainerHandle handle) protected booleanuse(BaseContainerHandle handle, boolean forUpdate, boolean droppedOK) Lock the container and mark the container as in-use by this container handle.protected voidwritePage(long pageNumber, byte[] pageData, boolean syncPage) Write the page, if it's within range of the current page range of the container.Methods inherited from class RAFContainer
backupContainer, clean, closeContainer, createContainer, encryptOrDecryptContainer, flushAll, getRandomAccessFile, isDirty, openContainer, readPage, removeFile, reopenContainer, run, truncatePages, updatePageArrayMethods inherited from class FileContainer
bumpContainerVersion, canUpdate, clearIdentity, clearPreallocThreshold, compressContainer, createIdent, deallocatePage, decryptPage, doPreAllocatePages, dropContainer, encryptPage, getAllocPage, getAnyPage, getContainerProperties, getContainerVersion, getContextService, getEmbryonicPage, getEmbryonicPage, getEncryptionBuffer, getEstimatedPageCount, getEstimatedRowCount, getFirstHeadPage, getHeadPage, getLastPageNumber, getLatchedPage, getMinimumRecordSize, getNextHeadPage, getPage, getPageForCompress, getPageForInsert, getPageSize, getReusableRecordIdSequenceNumber, getSpaceInfo, getSpareSpace, getTypeFormatId, incrementReusableRecordIdSequenceNumber, initPage, latchPage, logCreateContainerInfo, newPage, preDirty, prepareForBulkLoad, readHeader, reCreatePageForRedoRecovery, setDirty, setEstimatedRowCount, setIdent, trackUnfilledPage, updateEstimatedRowCount, writeAtOffset, writeHeader, writeHeaderMethods inherited from class BaseContainer
compressContainer, fillInIdentity, getAllocPage, getAnyPage, getCommittedDropState, getContainerId, getContainerStatus, getDeallocLock, getDroppedState, getFirstPage, getIdentity, getNextPage, getSegmentId, isReusableRecordId, lockAttributes, lockerAlwaysCompatible, lockEvent, removePage, requestCompatible, setCommittedDropState, setDroppedState, setReusableRecordIdState, unlockEventMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Cacheable
getIdentity
-
Field Details
-
inUseCount
protected int inUseCount
-
-
Constructor Details
-
TempRAFContainer
TempRAFContainer(BaseDataFileFactory factory)
-
-
Method Details
-
setIdentity
Description copied from class:FileContainerOpen the container.- Specified by:
setIdentityin interfaceCacheable- Overrides:
setIdentityin classFileContainer- Returns:
- a valid object if the container was successfully opened, null if it does not exist.
- Throws:
StandardException- Standard Derby error policy- See Also:
-
createIdentity
Description copied from interface:CacheableCreate a new item.Create a new item and set the identity of the object to represent it. The object will be in the No Identity state, ie. it will have just been created or clearIdentity() was just called.
The object must copy the information out of key, not just store a reference to key if the key is not immutable. After this call the expression getIdentity().equals(key) must return true.
If the class of the object needs to change (e.g. to support a different format) then the object should create a new object, call its initParameter() with the parameters the original object was called with, set its identity and return a reference to it. The cache manager will discard the reference to the old object.
If an exception is thrown the object must be left in the no-identity state.
MT - single thread required - Method must only be called be cache manager and the cache manager will guarantee only one thread can be calling it.- Specified by:
createIdentityin interfaceCacheable- Overrides:
createIdentityin classFileContainer- Returns:
- an object reference if the object can take on the identity, null otherwise.
- Throws:
StandardException- Standard Derby error policy- See Also:
-
removeContainer
Description copied from class:RAFContainerRemove the container- Overrides:
removeContainerin classRAFContainer- Parameters:
leaveStub- if true, leave a stub. If false, remove everything- Throws:
StandardException- Standard Derby error policy- See Also:
-
preAllocate
protected int preAllocate(long lastPreallocPagenum, int preAllocSize) Preallocate page. Since we don't sync when we write page anyway, no need to preallocate page.- Overrides:
preAllocatein classRAFContainer- Parameters:
lastPreallocPagenum- the last preallocated page number as known by the allocation pagepreAllocSize- try to preallocate this page number of pages. Since only the container knows how many pages are actually on disk, it may determine that certain number of pages that the allocation page thinks need to be preallocated is already allocated, in those case, act as if the preallocation is successful.- Returns:
- number of successfully preallocated page, or 0 if no page has been preallocated
-
writePage
protected void writePage(long pageNumber, byte[] pageData, boolean syncPage) throws IOException, StandardException Write the page, if it's within range of the current page range of the container. If we do write it then don't request that it be synced.- Overrides:
writePagein classRAFContainer- Throws:
StandardException- Standard Derby error policyIOException- IO error accessing page
-
getFileName
StorageFile getFileName(ContainerKey identity, boolean stub, boolean errorOK, boolean tryAlternatePath) - Overrides:
getFileNamein classRAFContainer
-
privGetFileName
protected StorageFile privGetFileName(ContainerKey identity, boolean stub, boolean errorOK, boolean tryAlternatePath) - Overrides:
privGetFileNamein classRAFContainer
-
addPage
Add a page without locking the container, only one user will be accessing this table at a time.- Overrides:
addPagein classBaseContainer- Throws:
StandardException- Standard Derby error policy
-
truncate
- Overrides:
truncatein classBaseContainer- Throws:
StandardException- Standard Derby error policy
-
use
protected boolean use(BaseContainerHandle handle, boolean forUpdate, boolean droppedOK) throws StandardException Lock the container and mark the container as in-use by this container handle.- Overrides:
usein classBaseContainer- Parameters:
droppedOK- if true, use this container even if it is dropped.,- Returns:
- true if the container can be used, false if it has been dropped since the lock was requested and droppedOK is not true.
- Throws:
StandardException- I cannot be opened for update.
-
letGo
Discontinue use of this container. Note that the unlockContainer call made from this method may not release any locks. The container lock may be held until the end of the transaction.- Overrides:
letGoin classFileContainer
-
isSingleUser
public boolean isSingleUser()Returns true if only a single handle is connected to this container.
-