Interface CustomHandler

All Superinterfaces:
Handler

public interface CustomHandler extends Handler
Handler for custom transactional operations. Undo operations are applied to roll back transactions, and redo operations are applied by recovery and replication. A companion instance for writing custom operations is provided by the Database.customWriter method.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    redo(Transaction txn, byte[] message)
    Called to write or apply an idempotent redo operation.
    void
    redo(Transaction txn, byte[] message, long indexId, byte[] key)
    Called to write or apply an idempotent redo operation which locked an index key.
    void
    undo(Transaction txn, byte[] message)
    Called to write or apply an idempotent undo operation.

    Methods inherited from interface org.cojen.tupl.ext.Handler

    init
  • Method Details

    • redo

      void redo(Transaction txn, byte[] message) throws IOException
      Called to write or apply an idempotent redo operation.
      Parameters:
      txn - transaction the operation applies to; can be modified
      message - custom message
      Throws:
      NullPointerException - if transaction or message is null
      IOException
    • redo

      void redo(Transaction txn, byte[] message, long indexId, byte[] key) throws IOException
      Called to write or apply an idempotent redo operation which locked an index key. The lock ensures that redo operations are ordered with respect to other transactions which locked the same key.
      Parameters:
      txn - transaction the operation applies to; can be modified
      message - custom message
      indexId - non-zero index for lock acquisition
      key - non-null key which has been locked exclusively
      Throws:
      NullPointerException - if transaction or message is null
      IllegalStateException - if index and key are provided but lock isn't held
      IllegalArgumentException - if index id is zero and key is non-null
      IOException
    • undo

      void undo(Transaction txn, byte[] message) throws IOException
      Called to write or apply an idempotent undo operation.
      Parameters:
      txn - transaction the operation applies to; is null when rolling back
      message - custom message
      Throws:
      NullPointerException - if transaction or message is null; applicable to writer instance only
      IOException