Class ManagedResourceTransactionContext

java.lang.Object
org.j7m.middleware.application.distributed.ManagedResourceTransactionContext

public final class ManagedResourceTransactionContext extends Object
Same-invocation strict-2PL resource capability; commits belong exclusively to the host finalizer. Reads acquire durable native locks before observing values. Writes are local intents until prepare and a durable coordinator decision. At most64 distinct reads/ranges/writes and256KiB textual data are admitted. Prepared locks never expire merely because the caller or coordinator disappeared.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    lockRange(String participant, String prefix)
    Acquires the native conservative tenant-wide predicate lock for a logical prefix.
    org.j7m.middleware.distributed.ReplicatedResources.Value
    read(String participant, String key)
    Reads a locked value, including this transaction's staged write and the observed base version.
    boolean
    Returns the sticky rollback-only state without granting commit authority.
    void
    Marks the entire REQUIRED transaction rollback-only; a nested caller cannot clear this flag.
    Returns the durable opaque transaction ID for authorized native recovery/status operations.
    void
    write(String participant, String key, String value)
    Stages a write after locking its observed base value; publication occurs only with durable COMMIT.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • transactionId

      public String transactionId()
      Returns the durable opaque transaction ID for authorized native recovery/status operations.
      Returns:
      unique ID within the backend authorization scope; never a bearer permission
    • read

      public org.j7m.middleware.distributed.ReplicatedResources.Value read(String participant, String key) throws IOException
      Reads a locked value, including this transaction's staged write and the observed base version. A staged value's version is its observed pre-commit version, not a future commit index.
      Parameters:
      participant - explicitly host-registered participant ID
      key - nonblank key, at most128 characters without NUL or reserved star
      Returns:
      locked value/version, or null for absent
      Throws:
      IOException - for unavailable/uncertain native operation; transaction becomes rollback-only
      org.j7m.middleware.api.MiddlewareException - for invalid bounds, conflicts or exhausted capacity
      IllegalStateException - outside the owning open USER context
    • write

      public void write(String participant, String key, String value) throws IOException
      Stages a write after locking its observed base value; publication occurs only with durable COMMIT.
      Parameters:
      participant - registered participant ID
      key - bounded resource key
      value - at most16384 characters without NUL
      Throws:
      IOException - for unavailable/uncertain read or enlist
      org.j7m.middleware.api.MiddlewareException - for invalid value or capacity
      IllegalStateException - outside the owning USER phase
    • lockRange

      public void lockRange(String participant, String prefix) throws IOException
      Acquires the native conservative tenant-wide predicate lock for a logical prefix. The lock protects subsequent participating reads and prevents phantoms through prepare/recovery; this method does not invent a separate range query or expose a raw endpoint.
      Parameters:
      participant - registered participant ID
      prefix - at most128 characters, possibly empty, without NUL or reserved star
      Throws:
      IOException - for unavailable/uncertain native lock
      org.j7m.middleware.api.MiddlewareException - for invalid bounds, conflict or capacity
    • setRollbackOnly

      public void setRollbackOnly()
      Marks the entire REQUIRED transaction rollback-only; a nested caller cannot clear this flag.
      Throws:
      IllegalStateException - outside the owning open USER scope
    • rollbackOnly

      public boolean rollbackOnly()
      Returns the sticky rollback-only state without granting commit authority.
      Returns:
      whether a nested failure or explicit request requires rollback