public interface ConflictHandler
ConflictHandler is invoked when a 409 Conflict or 412 Precondition Failed is returned in
response to a PATCH.
The PassClient includes an If-Match header on PATCH requests
to the Fedora repository. When 412 Precondition Failed is returned, this handler is invoked to resolve the
conflict. A naive implementation may invoke a back-off and re-try the request.
| Modifier and Type | Method and Description |
|---|---|
<T extends org.dataconservancy.pass.model.PassEntity,R> |
handleConflict(T conflictedResource,
Class<T> resourceClass,
Predicate<T> preCondition,
Function<T,R> criticalUpdate)
Invoked when a
412 Precondition Failed is returned from a PATCH request to the repository. |
<T extends org.dataconservancy.pass.model.PassEntity,R> R handleConflict(T conflictedResource,
Class<T> resourceClass,
Predicate<T> preCondition,
Function<T,R> criticalUpdate)
412 Precondition Failed is returned from a PATCH request to the repository.
Implementations are provided the the resource that includes the state to be updated, the function that performs the update, and the precondition that ought to be satisfied prior to invoking the update function.
Because this handler is being invoked in response to a 412, simply re-submitting the {PATCH} request with
the supplied resource will always fail. Implementations will need to re-retrieve the the latest
state of the resource, optionally apply the preCondition (insuring that the new state of the resource is
still valid with respect to the criticalUpdate to be applied), and invoke the criticalUpdate.
T - the type of resourceR - the type of the response returned by the criticalUpdateconflictedResource - the resource with the state to be updatedresourceClass - the runtime class of the resourcepreCondition - the precondition that must be satisfied in order for the criticalUpdate to be appliedcriticalUpdate - the update to be applied to the resourcecriticalUpdateCopyright © 2019. All rights reserved.