Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of MP FT 2.1.1 using FT SE #2348

Merged
merged 67 commits into from Sep 14, 2020
Merged

Conversation

spericas
Copy link
Member

@spericas spericas commented Sep 9, 2020

Replacing FailSafe and Hystrix by our own implementation of FT primitives. Some minor changes to our first version of these primitive operations was necessary to be fully compatible with MP and pass all the TCKs.

…nous. Passing unit tests FallbackTest, RetryTest and AsynchronousTest.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
…fied ErrorChecker to use subtyping instead of equality when comparing exceptions.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
…T annotations.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
 - Support for sync (no queues) in Bulkhead
 - Fixed validation in FallbackAntn
 - Fixes to CommandRunner async support
 - Some changes in unit tests while preserving coverage

 All unit tests for Timeout, Fallback, Retry, Asynchronous, Bulkhead and CircuitBreaker are passing.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
 - Support for metrics for all primitives except bulkheads
 - Changes to SE Retry to count number of retries
 - Some test fixes

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
 - New method in Bulkhead to return stats
 - Support for all metrics related to bulkheads
 - Some minor test changes

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
…CKs, only the CDI request scope is active. Temporarily disable annotation validation in CDI extension as this now causes TCKs to fail validation before running.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
…n and then applyOn sets. Updates to some tests.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
…tionStage<?>.

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
 - Handle timeouts when a method catches InterruptedException
 - Changes to SE FT to support some event listeners
 - Create handlers for each invocation while sharing those for Bulkheads and CircuitBreakers
 - Renamed CommandRunner to MethodInvoker

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
@spericas spericas self-assigned this Sep 9, 2020
@spericas spericas added this to the 2.1.0 milestone Sep 9, 2020
@spericas spericas added this to Normal priority in Backlog Sep 9, 2020
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
@spericas spericas changed the title WIP: Implementation of MP FT 2.1.1 using FT SE Implementation of MP FT 2.1.1 using FT SE Sep 9, 2020
Comment on lines 36 to 49
CompletableFuture<T> future = new CompletableFuture<>();
AsyncTask<T> task = new AsyncTask<>(supplier, future);

Future<?> taskFuture;
try {
executor.get().submit(task);
taskFuture = executor.get().submit(task);
} catch (Throwable e) {
// rejected execution and other executor related issues
return Single.error(e);
}

return Single.create(future);
Single<T> single = Single.create(future, true);
single.onCancel(() -> taskFuture.cancel(false)); // cancel task
return single;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like duplication of CompletableFuture.supplyAsync internals, is there some AsyncTask's feature I missed @tomas-langer, or we can simplify?

    public <T> Single<T> invoke(Supplier<T> supplier) {
        try {
            return Single.create(CompletableFuture.supplyAsync(task, executor.get()), true);
        } catch (Throwable e) {
            // rejected execution and other executor related issues
            return Single.error(e);
        }
    }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but not sure it is more readable tbh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code has changed now, see below

Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Comment on lines +284 to +289
StringBuilder sb = new StringBuilder();
for (int i = validFts.size() - 1; i >= 0; i--) {
sb.append(validFts.get(i).toString());
sb.append("\n");
}
return sb.toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validFts is always LinkedList, using descendingIterator would be nice

@spericas spericas merged commit 74956be into helidon-io:master Sep 14, 2020
Backlog automation moved this from Normal priority to Closed Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Backlog
  
Closed
Development

Successfully merging this pull request may close these issues.

None yet

4 participants