[JBoss JIRA] (ISPN-5467) Design new interceptor interfaces for sequential invocation
by Dan Berindei (JIRA)
[ https://issues.jboss.org/browse/ISPN-5467?page=com.atlassian.jira.plugin.... ]
Dan Berindei edited comment on ISPN-5467 at 8/22/16 9:03 AM:
-------------------------------------------------------------
[~belaban] it's probably worth a wiki page, but I'm going to add a brief description here :)
I've just issued a new [PR|https://github.com/infinispan/infinispan/pull/4520], so that's what I'm going to describe.
* Interceptors extending {{CommandInterceptor}} still work, and can use only {{invokeNext(ctx, command)}} to invoke the next interceptor synchronously.
* The new base class is {{BaseAsyncInterceptor}}, which defines a single {{visitCommand(InvocationContext, VisitableCommand)}} entry point.
* {{DDAsyncInterceptor}} extends {{BaseAsyncInterceptor}} to add the familiar {{visitXCommand(\[Tx\]InvocationContext, XCommand)}} entry points.
* The return type of the {{visitXCommand}} methods is {{BasicInvocationStage}}, only allow you to extract a value or convert to a {{CompletableFuture}}.
* {{BaseAsyncInterceptor}} defines some methods that return a {{BasicInvocationStage}}, or a more feature-full {{InterceptorStage}} instance:
** {{invokeNext(ctx, command)}} works just like {{CommandInterceptor.invokeNext}}, except the invocation may be asynchronous.
** {{returnWith(value)}} returns a value, because we can't just return a value directly.
** {{goAsync(CompletableFuture<BasicInvocationStage>}} continues the invocation asynchronously.
** {{invokeNextAsync(ctx, command, future)}} is a shortcut for {{goAsync(f.thenApply(o -> invokeNext(ctx, command)))}.
** {{returnWithAsync(value)}} is a shortcut for {{goAsync(f.thenApply(o -> returnWith(ctx, command)))}.
* {{InvocationStage}} extends {{BasicInvocationStage}} with a few more {{CompletionStage}}-like features. The main differences from {{CompletionStage}} are:
** All callbacks receive two extra parameters: the context and the command. In many interceptors, this allows us to store the callback in a field instead of creating a new instance on each invocation.
** Callbacks can throw {{Throwable}}, and received exceptions are not wrapped in `CompletionException`. I'm on the edge about this, but I'm sure a switch to `CompletionException` wrapping should be have a separate issue anyway.
** Not all {{CompletionStage}} methods are implemented, e.g. we don't support combining two invocation stages with {{thenCombine}}.
** We also have one extra method, {{compose((BasicInvocationStage, InvocationStage, VisitableCommand, Object, Throwable) -> BasicInvocationStage}}. It works like {{CompletionStage.thenCompose}}, but the callback gets called even if the invocation stage failed.
was (Author: dan.berindei):
[~belaban] it's probably worth a wiki page, but I'm going to add a brief description here :)
I've just issued a new [PR|https://github.com/infinispan/infinispan/pull/4520], so that's what I'm going to describe.
* Interceptors extending {{CommandInterceptor}} still work, and can use only {{invokeNext(ctx, command)}} to invoke the next interceptor synchronously.
* The new base class is {{BaseAsyncInterceptor}}, which defines a single {{visitCommand(InvocationContext, VisitableCommand)}} entry point.
* {{DDAsyncInterceptor}} extends {{BaseAsyncInterceptor}} to add the familiar {{visitXCommand(\[Tx\]InvocationContext, XCommand)}} entry points.
* The return type of the {{visitXCommand}} methods is {{BasicInvocationStage}}, only allow you to extract a value or convert to a {{CompletableFuture}}.
* {{BaseAsyncInterceptor}} defines some methods that return a {{BasicInvocationStage}}, or a more feature-full {{InterceptorStage}} instance:
** {{invokeNext(ctx, command)}} works just like {{CommandInterceptor.invokeNext}}, except the invocation may be asynchronous.
** {{returnWith(value)}} returns a value, because we can't just return a value directly.
** {{goAsync(CompletableFuture<BasicInvocationStage>}} continues the invocation asynchronously.
** {{invokeNextAsync(ctx, command, future)}} is a shortcut for {{goAsync(f.thenApply(o -> invokeNext(ctx, command)))}.
** {{returnWithAsync(value)}} is a shortcut for {{goAsync(f.thenApply(o -> returnWith(ctx, command)))}.
* {{InvocationStage}} extends {{BasicInvocationStage}} with a few more {{CompletionStage}}-like features. The main differences from {{CompletionStage}} are:
** All callbacks receive two extra parameters: the context and the command. In many interceptors, this allows us to store the callback in a field instead of creating a new instance on each invocation.
** Callbacks can throw {{Throwable}}, and received exceptions are not wrapped in `CompletionException`. I'm on the edge about this, but I'm sure a switch to `CompletionException` wrapping should be have a separate issue anyway.
** Not all {{CompletionStage}} methods are implemented, e.g. we don't support combining two invocation stages with {{thenCombine}}.
** We also have one extra method, {{compose((BasicInvocationStage, InvocationStage, VisitableCommand, Object, Throwable) -> BasicInvocationStage. It works like {{CompletionStage.thenCompose}}, but the callback gets called even if the invocation stage failed.
> Design new interceptor interfaces for sequential invocation
> -----------------------------------------------------------
>
> Key: ISPN-5467
> URL: https://issues.jboss.org/browse/ISPN-5467
> Project: Infinispan
> Issue Type: Task
> Components: Core
> Affects Versions: 7.2.1.Final
> Reporter: Dan Berindei
> Assignee: Dan Berindei
> Fix For: 9.0.0.Beta1, 9.0.0.Final
>
>
> We need the interceptors to execute in sequence instead of using a stack in order to allow interrupting the execution of a command on one thread and continuing the execution on another thread.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 7 months
[JBoss JIRA] (ISPN-6626) IntegrationTest.testGet* fails on Windows
by Anna Manukyan (JIRA)
[ https://issues.jboss.org/browse/ISPN-6626?page=com.atlassian.jira.plugin.... ]
Anna Manukyan updated ISPN-6626:
--------------------------------
Status: Open (was: New)
> IntegrationTest.testGet* fails on Windows
> -----------------------------------------
>
> Key: ISPN-6626
> URL: https://issues.jboss.org/browse/ISPN-6626
> Project: Infinispan
> Issue Type: Bug
> Components: Security
> Affects Versions: 9.0.0.Alpha1
> Environment: * Windows CI machine
> Reporter: Sebastian Łaskawiec
> Assignee: Anna Manukyan
>
> {{IntegrationTest.testGet*}} tests fail on Windows CI.
> Link: http://ci.infinispan.org/viewLog.html?buildId=39675&tab=buildResultsDiv&b...
> Stacktrace:
> {noformat}
> java.lang.AssertionError:
> at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:24)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:33)
> at org.infinispan.rest.IntegrationTest.testGetCollection(IntegrationTest.scala:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
> at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
> at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
> at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
> at org.testng.TestRunner.privateRun(TestRunner.java:767)
> at org.testng.TestRunner.run(TestRunner.java:617)
> at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
> at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)
> at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)
> at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> ------- Stdout: -------
> [TestSuiteProgress] Test starting: org.infinispan.rest.IntegrationTest.testGetCollection
> 20:25:53,866 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> 20:25:53,875 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> 20:25:53,883 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> [TestSuiteProgress] Test failed: org.infinispan.rest.IntegrationTest.testGetCollection
> 20:25:53,884 ERROR (testng-IntegrationTest) [TestSuiteProgress] Test failed: org.infinispan.rest.IntegrationTest.testGetCollection
> java.lang.AssertionError:
> at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:24)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:33)
> at org.infinispan.rest.IntegrationTest.testGetCollection(IntegrationTest.scala:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)[TestSuiteProgress] Tests succeeded: 23, failed: 1, skipped: 0
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 7 months
[JBoss JIRA] (ISPN-6626) IntegrationTest.testGet* fails on Windows
by Anna Manukyan (JIRA)
[ https://issues.jboss.org/browse/ISPN-6626?page=com.atlassian.jira.plugin.... ]
Anna Manukyan updated ISPN-6626:
--------------------------------
Status: Pull Request Sent (was: Open)
Git Pull Request: https://github.com/infinispan/infinispan/pull/4525
> IntegrationTest.testGet* fails on Windows
> -----------------------------------------
>
> Key: ISPN-6626
> URL: https://issues.jboss.org/browse/ISPN-6626
> Project: Infinispan
> Issue Type: Bug
> Components: Security
> Affects Versions: 9.0.0.Alpha1
> Environment: * Windows CI machine
> Reporter: Sebastian Łaskawiec
> Assignee: Anna Manukyan
>
> {{IntegrationTest.testGet*}} tests fail on Windows CI.
> Link: http://ci.infinispan.org/viewLog.html?buildId=39675&tab=buildResultsDiv&b...
> Stacktrace:
> {noformat}
> java.lang.AssertionError:
> at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:24)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:33)
> at org.infinispan.rest.IntegrationTest.testGetCollection(IntegrationTest.scala:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
> at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
> at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
> at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
> at org.testng.TestRunner.privateRun(TestRunner.java:767)
> at org.testng.TestRunner.run(TestRunner.java:617)
> at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
> at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)
> at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)
> at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> ------- Stdout: -------
> [TestSuiteProgress] Test starting: org.infinispan.rest.IntegrationTest.testGetCollection
> 20:25:53,866 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> 20:25:53,875 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> 20:25:53,883 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> [TestSuiteProgress] Test failed: org.infinispan.rest.IntegrationTest.testGetCollection
> 20:25:53,884 ERROR (testng-IntegrationTest) [TestSuiteProgress] Test failed: org.infinispan.rest.IntegrationTest.testGetCollection
> java.lang.AssertionError:
> at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:24)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:33)
> at org.infinispan.rest.IntegrationTest.testGetCollection(IntegrationTest.scala:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)[TestSuiteProgress] Tests succeeded: 23, failed: 1, skipped: 0
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 7 months
[JBoss JIRA] (ISPN-6626) IntegrationTest.testGet* fails on Windows
by Anna Manukyan (JIRA)
[ https://issues.jboss.org/browse/ISPN-6626?page=com.atlassian.jira.plugin.... ]
Anna Manukyan reassigned ISPN-6626:
-----------------------------------
Assignee: Anna Manukyan (was: Tristan Tarrant)
> IntegrationTest.testGet* fails on Windows
> -----------------------------------------
>
> Key: ISPN-6626
> URL: https://issues.jboss.org/browse/ISPN-6626
> Project: Infinispan
> Issue Type: Bug
> Components: Security
> Affects Versions: 9.0.0.Alpha1
> Environment: * Windows CI machine
> Reporter: Sebastian Łaskawiec
> Assignee: Anna Manukyan
>
> {{IntegrationTest.testGet*}} tests fail on Windows CI.
> Link: http://ci.infinispan.org/viewLog.html?buildId=39675&tab=buildResultsDiv&b...
> Stacktrace:
> {noformat}
> java.lang.AssertionError:
> at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:24)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:33)
> at org.infinispan.rest.IntegrationTest.testGetCollection(IntegrationTest.scala:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
> at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
> at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
> at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
> at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
> at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
> at org.testng.TestRunner.privateRun(TestRunner.java:767)
> at org.testng.TestRunner.run(TestRunner.java:617)
> at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
> at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)
> at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)
> at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> ------- Stdout: -------
> [TestSuiteProgress] Test starting: org.infinispan.rest.IntegrationTest.testGetCollection
> 20:25:53,866 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> 20:25:53,875 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> 20:25:53,883 WARN [org.apache.commons.httpclient.HttpMethodBase] (testng-IntegrationTest) Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
> [TestSuiteProgress] Test failed: org.infinispan.rest.IntegrationTest.testGetCollection
> 20:25:53,884 ERROR (testng-IntegrationTest) [TestSuiteProgress] Test failed: org.infinispan.rest.IntegrationTest.testGetCollection
> java.lang.AssertionError:
> at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:24)
> at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:33)
> at org.infinispan.rest.IntegrationTest.testGetCollection(IntegrationTest.scala:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)[TestSuiteProgress] Tests succeeded: 23, failed: 1, skipped: 0
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 7 months