Class TempRAFContainer

  • All Implemented Interfaces:
    java.security.PrivilegedExceptionAction<java.lang.Object>, Cacheable, TypedFormat, Lockable

    class TempRAFContainer
    extends RAFContainer
    needsSync is never true - DONE An exception never marks the store as corrupt clean() does not stubbify preAllocate() does nothing - DONE getFileName() returns a file in the tmp directory - DONE flushAll does nothing - DONE file descriptor is never synced
    • Field Detail

      • inUseCount

        protected int inUseCount
    • Method Detail

      • createIdentity

        public Cacheable createIdentity​(java.lang.Object key,
                                        java.lang.Object createParameter)
                                 throws StandardException
        Description copied from interface: Cacheable
        Create 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:
        createIdentity in interface Cacheable
        Overrides:
        createIdentity in class FileContainer
        Returns:
        an object reference if the object can take on the identity, null otherwise.
        Throws:
        StandardException - Standard Derby error policy
        See Also:
        CacheManager.create(java.lang.Object, java.lang.Object)
      • 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:
        preAllocate in class RAFContainer
        Parameters:
        lastPreallocPagenum - the last preallocated page number as known by the allocation page
        preAllocSize - 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 java.io.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:
        writePage in class RAFContainer
        Throws:
        StandardException - Standard Derby error policy
        java.io.IOException - IO error accessing page
      • 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:
        use in class BaseContainer
        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

        protected void letGo​(BaseContainerHandle handle)
        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:
        letGo in class FileContainer
      • isSingleUser

        public boolean isSingleUser()
        Returns true if only a single handle is connected to this container.