Class IdempotencyRequestContext
java.lang.Object
org.apache.polaris.service.idempotency.IdempotencyRequestContext
Request-scoped holder for a pending entity-property idempotency key. The REST adapter sets the
key before invoking the handler;
LocalIcebergCatalog reads it when committing a create so
the key is stamped atomically with the new entity.
Although request-scoped, the same instance can be touched from more than one thread over a
request's lifetime (e.g. the IdempotencyKeyFilter vs. the REST service code), so the
pending key is held in an AtomicReference — mirroring RealmContextHolder.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IdempotencyRequestContextShared no-op context for code paths that build a catalog without request-scoped idempotency (e.g. -
Constructor Summary
ConstructorsConstructorDescriptionIdempotencyRequestContext(IdempotencyConfiguration idempotencyConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoidResets the pending state.booleanisActive()Whether entity-property idempotency applies to the current request: the feature is enabled and a well-formedIdempotency-Keywas supplied (and thus captured byIdempotencyKeyFilter).@Nullable Instant@Nullable UUIDvoidsetPendingKey(@Nullable UUID key) Recordskeyfor the current request, computing expiry fromIdempotencyConfiguration.ttl().
-
Field Details
-
DISABLED
Shared no-op context for code paths that build a catalog without request-scoped idempotency (e.g. non-CDI construction and tests).isActive()is alwaysfalse, so callers can hold a non-null context instead of null-checking.
-
-
Constructor Details
-
IdempotencyRequestContext
-
-
Method Details
-
setPendingKey
Recordskeyfor the current request, computing expiry fromIdempotencyConfiguration.ttl(). No-op whenkeyisnullor on theDISABLEDcontext. -
isActive
public boolean isActive()Whether entity-property idempotency applies to the current request: the feature is enabled and a well-formedIdempotency-Keywas supplied (and thus captured byIdempotencyKeyFilter). Whentrue,pendingKey()is non-null. -
pendingKey
-
pendingExpiry
-
clearPending
public void clearPending()Resets the pending state. Not needed in production, where each request gets a freshRequestScopedinstance; provided so tests that drive multiple logical requests through a shared instance can simulate that per-request lifecycle.
-