Class ManagedResourceTransactionContext
java.lang.Object
org.j7m.middleware.application.distributed.ManagedResourceTransactionContext
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 TypeMethodDescriptionvoidAcquires the native conservative tenant-wide predicate lock for a logical prefix.org.j7m.middleware.distributed.ReplicatedResources.ValueReads a locked value, including this transaction's staged write and the observed base version.booleanReturns the sticky rollback-only state without granting commit authority.voidMarks 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.voidStages a write after locking its observed base value; publication occurs only with durable COMMIT.
-
Method Details
-
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 IDkey- 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-onlyorg.j7m.middleware.api.MiddlewareException- for invalid bounds, conflicts or exhausted capacityIllegalStateException- outside the owning open USER context
-
write
Stages a write after locking its observed base value; publication occurs only with durable COMMIT.- Parameters:
participant- registered participant IDkey- bounded resource keyvalue- at most16384 characters without NUL- Throws:
IOException- for unavailable/uncertain read or enlistorg.j7m.middleware.api.MiddlewareException- for invalid value or capacityIllegalStateException- outside the owning USER phase
-
lockRange
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 IDprefix- at most128 characters, possibly empty, without NUL or reserved star- Throws:
IOException- for unavailable/uncertain native lockorg.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
-