Documentation of 'org.apache.derby.impl.store.raw.xact.XactFactory' Java class
XactFactory
org.apache.derby.impl.store.raw.xact

Class XactFactory

    • Constructor Detail

      • XactFactory

        public XactFactory()
    • Method Detail

      • canSupport

        public boolean canSupport(java.util.Properties startParams)
        Description copied from interface: ModuleSupportable
        See if this implementation can support any attributes that are listed in properties. This call may be made on a newly created instance before the boot() method has been called, or after the boot method has been called for a running module.

        The module can check for attributes in the properties to see if it can fulfill the required behaviour. E.g. the raw store may define an attribute called RawStore.Recoverable. If a temporary raw store is required the property RawStore.recoverable=false would be added to the properties before calling bootServiceModule. If a raw store cannot support this attribute its canSupport method would return null. Also see the Monitor class's prologue to see how the identifier is used in looking up properties.
        Actually a better way maybe to have properties of the form RawStore.Attributes.mandatory=recoverable,smallfootprint and RawStore.Attributes.requested=oltp,fast

        Specified by:
        canSupport in interface ModuleSupportable
        Returns:
        true if this instance can be used, false otherwise.
      • boot

        public void boot(boolean create,
                         java.util.Properties properties)
                  throws StandardException
        Description copied from interface: ModuleControl
        Boot this module with the given properties. Creates a module instance that can be found using the findModule() methods of Monitor. The module can only be found using one of these findModule() methods once this method has returned.

        An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.

        When create is true the contents of the properties object will be written to the service.properties of the persistent service. Thus any code that requires an entry in service.properties must explicitly place the value in this properties set using the put method.
        Typically the properties object contains one or more default properties sets, which are not written out to service.properties. These default sets are how callers modify the create process. In a JDBC connection database create the first set of defaults is a properties object that contains the attributes that were set on the jdbc:derby: URL. This attributes properties set has the second default properties set as its default. This set (which could be null) contains the properties that the user set on their DriverManager.getConnection() call, and are thus not owned by Derby code, and thus must not be modified by Derby code.

        When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases.

        Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.

        Specified by:
        boot in interface ModuleControl
        Throws:
        StandardException - Module cannot be started.
        See Also:
        Monitor, ModuleFactory
      • stop

        public void stop()
        Description copied from interface: ModuleControl
        Stop the module. The module may be found via a findModule() method until some time after this method returns. Therefore the factory must be prepared to reject requests to it once it has been stopped. In addition other modules may cache a reference to the module and make requests of it after it has been stopped, these requests should be rejected as well.
        Specified by:
        stop in interface ModuleControl
        See Also:
        Monitor, ModuleFactory
      • findTransaction

        public boolean findTransaction(TransactionId id,
                                       RawTransaction tran)
        Find the TransactionTableEntry with the given ID and make the passed in transaction assume the identity and properties of that TransactionTableEntry. Used in recovery only.
        Specified by:
        findTransaction in interface TransactionFactory
      • rollbackAllTransactions

        public void rollbackAllTransactions(RawTransaction recoveryTransaction,
                                            RawStoreFactory rsf)
                                     throws StandardException
        Rollback all active transactions that has updated the raw store. Use the recovery Transaction that is passed in to do all the work. Used in recovery only.

        Transactions are rolled back in the following order:

        1. internal transactions in reversed beginXact chronological order,
        2. all other transactions in reversed beginXact chronological order,
        Specified by:
        rollbackAllTransactions in interface TransactionFactory
        Parameters:
        recoveryTransaction - use this transaction to do all the user transaction work
        Throws:
        StandardException - any exception thrown during rollback
      • handlePreparedXacts

        public void handlePreparedXacts(RawStoreFactory rsf)
                                 throws StandardException
        Run through all prepared transactions known to this factory and restore their state such that they remain after recovery, and can be found and handled by a XA transaction manager. This includes creating a context manager for each, pushing a xact context, and reclaiming update locks on all data changed by the transaction. Expected to be called just after the redo and undo recovery loops, where the transaction table should be empty except for prepared xacts. Used only in recovery.
        Specified by:
        handlePreparedXacts in interface TransactionFactory
        Throws:
        StandardException - Derby Standard Error policy
      • firstUpdateInstant

        public LogInstant firstUpdateInstant()
        Get the earliest log instant that is still active, ie, the first log record logged by the earliest transaction that is still active.
        The logging system must guarentee that the transaction table is populated in the order transactions are started. Used in recovery only.
        Specified by:
        firstUpdateInstant in interface TransactionFactory
      • setNewTransactionId

        public void setNewTransactionId(TransactionId oldxid,
                                        Xact t)
      • resetTranId

        public void resetTranId()
        Set the shortTranId, this is called by the log factory after recovery
        Specified by:
        resetTranId in interface TransactionFactory
      • submitPostCommitWork

        public boolean submitPostCommitWork(Serviceable work)
        Submit this post commit work to the post commit daemon
        Specified by:
        submitPostCommitWork in interface TransactionFactory
        Returns:
        true if the daemon indicates it is being overloaded, false it's happy. must be MT-safe
      • noActiveUpdateTransaction

        public boolean noActiveUpdateTransaction()
        Returns true if there is no in flight updating tranasaction. Caller must be aware that if there is no other mechanism to stop transactions from starting and ending, then this information is outdated as soon as it is reported. Only call this function in special times - e.g, during recovery
        Specified by:
        noActiveUpdateTransaction in interface TransactionFactory
      • hasPreparedXact

        public boolean hasPreparedXact()
        Check if there are any prepared transanctions in the transaction table. Caller must be aware that if there is no other mechanism to stop transactions from starting and ending, then this information is outdated as soon as it is reported.
        Specified by:
        hasPreparedXact in interface TransactionFactory
        Returns:
        true if there are prepared transactions in the transaction table, false otherwise.
      • makeNewUUID

        public UUID makeNewUUID()
        Make a new UUID for whomever that wants it
      • inDatabaseCreation

        public boolean inDatabaseCreation()
        Returns:
        false, if the Database creation finished
      • blockBackupBlockingOperations

        public boolean blockBackupBlockingOperations(boolean wait)
        Checks if there are any backup blocking operations in progress and prevents new ones from starting until the backup is finished. If backup blocking operations are in progress and wait parameter value is true, then it will wait for the current backup blocking operations to finish. A Consistent backup can not be made if there are any backup blocking operations (like unlogged operations) are in progress
        Specified by:
        blockBackupBlockingOperations in interface TransactionFactory
        Parameters:
        wait - if true, waits for the current backup blocking operation in progress to finish.
        Returns:
        true if no backup blocking operations are in progress false otherwise.
        Throws:
        java.lang.RuntimeException - if runtime exception occurs, in which case other threads blocked on backupSemaphore are notified

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.