Class NullTransaction

    • Field Detail

      • startTime

        protected long startTime
      • phase

        protected int phase
      • commitCount

        private int commitCount
        Number of commit operation since starting up.
    • Constructor Detail

      • NullTransaction

        public NullTransaction()
    • Method Detail

      • getStartTime

        public long getStartTime()
        Returns the starting time.
        Specified by:
        getStartTime in interface TransactionMBean
        Returns:
        The starting time.
      • setPhase

        protected final void setPhase​(int newPhase)
      • init

        public void init​(String path)
                  throws IOException
        Description copied from interface: Transaction
        Initializes the atomic storage component.
        Specified by:
        init in interface Transaction
        Parameters:
        path - the path of storage directory.
        Throws:
        IOException - an error occurs.
      • getDir

        public File getDir()
      • getPersistenceDir

        public String getPersistenceDir()
        Returns the path of persistence directory.
        Returns:
        null.
      • begin

        public final void begin()
                         throws IOException
        Description copied from interface: Transaction
        Start a transaction validation, the validation phase needs 3 phases: begin, commit and release. The begin ensure the mutual exclusion of the current transaction.
        Specified by:
        begin in interface Transaction
        Throws:
        IOException - an error occurs.
      • getList

        public String[] getList​(String prefix)
        Description copied from interface: Transaction
        Returns an array of strings naming the objects in the component started by this prefix.
        Specified by:
        getList in interface Transaction
        Parameters:
        prefix - the prefix of searched objects.
        Returns:
        an array of strings naming the objects in the component started by this prefix.
      • useLoadAll

        public boolean useLoadAll()
        Description copied from interface: TransactionMBean
        Returns true if this Transaction implementation implements an optimized loadAll method.
        Specified by:
        useLoadAll in interface Transaction
        Specified by:
        useLoadAll in interface TransactionMBean
        Returns:
        true if this Transaction implementation implements an optimized loadAll method.
      • loadAll

        public void loadAll​(String prefix,
                            Map map)
        Description copied from interface: Transaction
        Fills the map with all objects of the component whose name begins with the prefix. Each loaded object is registered in the map with its persistent name as key.
        Specified by:
        loadAll in interface Transaction
        Parameters:
        prefix - The prefix of searched objects.
        map - The map of corresponding objects.
      • create

        public final void create​(Serializable obj,
                                 String name)
                          throws IOException
        Description copied from interface: Transaction
        Register the state of a newly created object in the current transaction.
        Specified by:
        create in interface Transaction
        Parameters:
        obj - the object to store.
        name - the name of the object.
        Throws:
        IOException - an error occurs.
      • create

        public final void create​(Serializable obj,
                                 String dirName,
                                 String name)
                          throws IOException
        Description copied from interface: Transaction
        Register the state of a newly created object in the current transaction.
        Specified by:
        create in interface Transaction
        Parameters:
        obj - the object to store.
        dirName - the directory name of the object.
        name - the name of the object.
        Throws:
        IOException - an error occurs.
      • save

        public final void save​(Serializable obj,
                               String name)
                        throws IOException
        Description copied from interface: Transaction
        Register the modified state of an object in the current transaction.
        Specified by:
        save in interface Transaction
        Parameters:
        obj - the object to store.
        name - the name of the object.
        Throws:
        IOException - an error occurs.
      • save

        public final void save​(Serializable obj,
                               String dirName,
                               String name)
                        throws IOException
        Description copied from interface: Transaction
        Register the modified state of an object in the current transaction.
        Specified by:
        save in interface Transaction
        Parameters:
        obj - the object to store.
        dirName - the directory name of the object.
        name - the name of the object.
        Throws:
        IOException - an error occurs.
      • save

        public void save​(Serializable obj,
                         String dirName,
                         String name,
                         boolean first)
                  throws IOException
        Description copied from interface: Transaction
        Register the state of an object in the current transaction.
        Specified by:
        save in interface Transaction
        Parameters:
        obj - the object to store.
        dirName - the directory name of the object.
        name - the name of the object.
        first - the object is a new one.
        Throws:
        IOException - an error occurs.
      • createByteArray

        public final void createByteArray​(byte[] buf,
                                          String name)
                                   throws IOException
        Description copied from interface: Transaction
        Register a new byte array in the current transaction.
        Specified by:
        createByteArray in interface Transaction
        Parameters:
        buf - the byte array to store.
        name - the name of the object.
        Throws:
        IOException - an error occurs.
      • createByteArray

        public final void createByteArray​(byte[] buf,
                                          String dirName,
                                          String name)
                                   throws IOException
        Description copied from interface: Transaction
        Register a new byte array in the current transaction.
        Specified by:
        createByteArray in interface Transaction
        Parameters:
        buf - the byte array to store.
        dirName - the directory name of the object.
        name - the name of the object.
        Throws:
        IOException - an error occurs.
      • saveByteArray

        public final void saveByteArray​(byte[] buf,
                                        String name)
                                 throws IOException
        Description copied from interface: Transaction
        Register a modified byte array in the current transaction.
        Specified by:
        saveByteArray in interface Transaction
        Parameters:
        buf - the byte array to store.
        name - the name of the object.
        Throws:
        IOException - an error occurs.
      • saveByteArray

        public final void saveByteArray​(byte[] buf,
                                        String dirName,
                                        String name)
                                 throws IOException
        Description copied from interface: Transaction
        Register a modified byte array in the current transaction.
        Specified by:
        saveByteArray in interface Transaction
        Parameters:
        buf - the byte array to store.
        dirName - the directory name of the object.
        name - the name of the object.
        Throws:
        IOException - an error occurs.
      • saveByteArray

        public void saveByteArray​(byte[] buf,
                                  String dirName,
                                  String name,
                                  boolean copy,
                                  boolean first)
                           throws IOException
        Description copied from interface: Transaction
        Register a modified byte array in the current transaction.
        Specified by:
        saveByteArray in interface Transaction
        Parameters:
        buf - the byte array to store.
        dirName - the directory name of the object.
        name - the name of the object.
        copy - the byte array can be modified, copy it.
        first - the object is a new one.
        Throws:
        IOException - an error occurs.
      • loadByteArray

        public final byte[] loadByteArray​(String name)
                                   throws IOException
        Description copied from interface: Transaction
        Load the specified byte array.
        Specified by:
        loadByteArray in interface Transaction
        Parameters:
        name - the name of the object.
        Returns:
        the loaded byte array.
        Throws:
        IOException - an error occurs.
      • loadByteArray

        public byte[] loadByteArray​(String dirName,
                                    String name)
                             throws IOException
        Description copied from interface: Transaction
        Load the specified byte array.
        Specified by:
        loadByteArray in interface Transaction
        Parameters:
        dirName - the directory name of the object.
        name - the name of the object.
        Returns:
        the loaded byte array.
        Throws:
        IOException - an error occurs.
      • delete

        public final void delete​(String name)
        Description copied from interface: Transaction
        Deletes the specified object.
        Specified by:
        delete in interface Transaction
        Parameters:
        name - the name of the object.
      • delete

        public void delete​(String dirName,
                           String name)
        Description copied from interface: Transaction
        Deletes the specified object.
        Specified by:
        delete in interface Transaction
        Parameters:
        dirName - the directory name of the object.
        name - the name of the object.
      • commit

        public void commit​(boolean release)
                    throws IOException
        Description copied from interface: Transaction
        Commit the current transaction.
        Specified by:
        commit in interface Transaction
        Parameters:
        release - if true releases the transaction at the end of the commit.
        Throws:
        IOException - an error occurs.
      • stop

        public final void stop()
        Description copied from interface: Transaction
        Stops the transaction module. It waits all transactions termination, then the module is kept in a FREE 'ready to use' state.
        Specified by:
        stop in interface Transaction
      • close

        public final void close()
        Description copied from interface: Transaction
        Close the transaction module. It waits all transactions termination, the module will be initialized anew before reusing it.
        Specified by:
        close in interface Transaction
      • containsOperations

        public boolean containsOperations()
        Indicates whether some operations have been done in this transaction.
        Specified by:
        containsOperations in interface Transaction
        Returns:
        true if some operations are waiting for commit in this transaction.
      • getOperationCount

        public int getOperationCount()
        Returns the number of operations to be committed.
        Specified by:
        getOperationCount in interface Transaction
        Returns:
        the number of operations to be committed.
      • backup

        public String backup​(String path)
                      throws Exception
        Backups the content of Transaction module. Produces a generic Backup/Restore file containing all living objects. Currently not implemented, throws an UnsupportedOperationException.
        Specified by:
        backup in interface Transaction
        Specified by:
        backup in interface TransactionMBean
        Parameters:
        path - Directory path to store the backup.
        Returns:
        the name of created backup file.
        Throws:
        Exception - An error occurs during backup.