Skip to content

Commit

Permalink
LRA Deprecations removal (helidon-io#4449)
Browse files Browse the repository at this point in the history
* LRA Deprecations removal

Signed-off-by: Daniel Kec <[email protected]>
  • Loading branch information
danielkec authored Jun 30, 2022
1 parent 8171f56 commit 6f4caa0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,6 @@ public interface CoordinatorClient {
*/
void init(Supplier<URI> coordinatorUriSupplier, long timeout, TimeUnit timeoutUnit);

/**
* Ask coordinator to start new LRA and return its id.
*
* @param clientID id specifying originating method/resource
* @param timeout after what time should be LRA cancelled automatically
* @return id of the new LRA
* @deprecated Use {@link io.helidon.lra.coordinator.client.CoordinatorClient#start(String, PropagatedHeaders, long)} instead
*/
@Deprecated
default Single<URI> start(String clientID, long timeout) {
return start(clientID, PropagatedHeaders.noop(), timeout);
}

/**
* Ask coordinator to start new LRA and return its id.
*
Expand All @@ -85,21 +72,6 @@ default Single<URI> start(String clientID, long timeout) {
*/
Single<URI> start(String clientID, PropagatedHeaders headers, long timeout);

/**
* Ask coordinator to start new LRA and return its id.
*
* @param parentLRA in case new LRA should be a child of already existing one
* @param clientID id specifying originating method/resource
* @param timeout after what time should be LRA cancelled automatically
* @return id of the new LRA
* @deprecated Use
* {@link io.helidon.lra.coordinator.client.CoordinatorClient#start(java.net.URI, String, PropagatedHeaders, long)} instead
*/
@Deprecated
default Single<URI> start(URI parentLRA, String clientID, long timeout) {
return start(parentLRA, clientID, PropagatedHeaders.noop(), timeout);
}

/**
* Ask coordinator to start new LRA and return its id.
*
Expand All @@ -111,21 +83,6 @@ default Single<URI> start(URI parentLRA, String clientID, long timeout) {
*/
Single<URI> start(URI parentLRA, String clientID, PropagatedHeaders headers, long timeout);

/**
* Join existing LRA with participant.
*
* @param lraId id of existing LRA
* @param timeLimit time limit in milliseconds after which should be LRA cancelled, 0 means never
* @param participant participant metadata with URLs to be called when complete/compensate ...
* @return recovery URI if supported by coordinator or empty
* @deprecated Use
* {@link io.helidon.lra.coordinator.client.CoordinatorClient#join(java.net.URI, PropagatedHeaders, long, Participant)} instead
*/
@Deprecated
default Single<Optional<URI>> join(URI lraId, long timeLimit, Participant participant) {
return join(lraId, PropagatedHeaders.noop(), timeLimit, participant);
}

/**
* Join existing LRA with participant.
*
Expand All @@ -137,19 +94,6 @@ default Single<Optional<URI>> join(URI lraId, long timeLimit, Participant partic
*/
Single<Optional<URI>> join(URI lraId, PropagatedHeaders headers, long timeLimit, Participant participant);

/**
* Cancel LRA if its active. Should cause coordinator to compensate its participants.
*
* @param lraId id of the LRA to be cancelled
* @return single future of the cancel call
* @deprecated Use
* {@link io.helidon.lra.coordinator.client.CoordinatorClient#cancel(java.net.URI, PropagatedHeaders)} instead
*/
@Deprecated
default Single<Void> cancel(URI lraId) {
return cancel(lraId, PropagatedHeaders.noop());
}

/**
* Cancel LRA if its active. Should cause coordinator to compensate its participants.
*
Expand All @@ -159,19 +103,6 @@ default Single<Void> cancel(URI lraId) {
*/
Single<Void> cancel(URI lraId, PropagatedHeaders headers);

/**
* Close LRA if its active. Should cause coordinator to complete its participants.
*
* @param lraId id of the LRA to be closed
* @return single future of the cancel call
* @deprecated Use
* {@link io.helidon.lra.coordinator.client.CoordinatorClient#close(java.net.URI, PropagatedHeaders)} instead
*/
@Deprecated
default Single<Void> close(URI lraId) {
return close(lraId, PropagatedHeaders.noop());
}

/**
* Close LRA if its active. Should cause coordinator to complete its participants.
*
Expand All @@ -181,21 +112,6 @@ default Single<Void> close(URI lraId) {
*/
Single<Void> close(URI lraId, PropagatedHeaders headers);

/**
* Leave LRA. Supplied participant won't be part of specified LRA any more,
* no compensation or completion will be executed on it.
*
* @param lraId id of the LRA that should be left by supplied participant
* @param participant participant which will leave
* @return single future of the cancel call
* @deprecated Use
* {@link io.helidon.lra.coordinator.client.CoordinatorClient#leave(java.net.URI, PropagatedHeaders, Participant)} instead
*/
@Deprecated
default Single<Void> leave(URI lraId, Participant participant) {
return leave(lraId, PropagatedHeaders.noop(), participant);
}

/**
* Leave LRA. Supplied participant won't be part of specified LRA any more,
* no compensation or completion will be executed on it.
Expand All @@ -207,19 +123,6 @@ default Single<Void> leave(URI lraId, Participant participant) {
*/
Single<Void> leave(URI lraId, PropagatedHeaders headers, Participant participant);

/**
* Return status of specified LRA.
*
* @param lraId id of the queried LRA
* @return {@link org.eclipse.microprofile.lra.annotation.LRAStatus} of the queried LRA
* @deprecated Use
* {@link io.helidon.lra.coordinator.client.CoordinatorClient#status(java.net.URI, PropagatedHeaders)} instead
*/
@Deprecated
default Single<LRAStatus> status(URI lraId) {
return status(lraId, PropagatedHeaders.noop());
}

/**
* Return status of specified LRA.
*
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void handleJaxRsBefore(ContainerRequestContext reqCtx, ResourceInfo resou
.ifPresent(lraId -> {
URI baseUri = reqCtx.getUriInfo().getBaseUri();
Participant p = participantService.participant(baseUri, resourceInfo.getResourceClass());
coordinatorClient.leave(lraId, p);
coordinatorClient.leave(lraId, PropagatedHeaders.noop(), p);
reqCtx.getHeaders().add(LRA_HTTP_CONTEXT_HEADER, lraId.toASCIIString());
reqCtx.setProperty(LRA_HTTP_CONTEXT_HEADER, lraId);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.helidon.common.reactive.Single;
import io.helidon.config.Config;
import io.helidon.lra.coordinator.client.CoordinatorClient;
import io.helidon.lra.coordinator.client.PropagatedHeaders;
import io.helidon.microprofile.config.ConfigCdiExtension;
import io.helidon.microprofile.lra.resources.CdiNestedCompleteOrCompensate;
import io.helidon.microprofile.lra.resources.CommonAfter;
Expand Down Expand Up @@ -437,7 +438,7 @@ void firstNotEnding(WebTarget target) throws Exception {
.get(TIMEOUT_SEC, TimeUnit.SECONDS);
assertThat(response.getStatus(), AnyOf.anyOf(is(200), is(204)));
URI lraId = await(DontEnd.CS_START_LRA);
assertThat(coordinatorClient.status(lraId).await(TIMEOUT_SEC, TimeUnit.SECONDS), is(LRAStatus.Active));
assertThat(coordinatorClient.status(lraId, PropagatedHeaders.noop()).await(TIMEOUT_SEC, TimeUnit.SECONDS), is(LRAStatus.Active));
assertThat(target.path(DontEnd.PATH_BASE)
.path(DontEnd.PATH_START_SECOND_LRA)
.request()
Expand Down Expand Up @@ -552,7 +553,7 @@ void statusNonRecoveryTest(WebTarget target) throws ExecutionException, Interrup

private void assertClosedOrNotFound(URI lraId) {
try {
assertThat(coordinatorClient.status(lraId).await(TIMEOUT_SEC, TimeUnit.SECONDS), is(LRAStatus.Closed));
assertThat(coordinatorClient.status(lraId, PropagatedHeaders.noop()).await(TIMEOUT_SEC, TimeUnit.SECONDS), is(LRAStatus.Closed));
} catch (NotFoundException e) {
// in case coordinator don't retain closed lra long enough
}
Expand Down

0 comments on commit 6f4caa0

Please sign in to comment.