GitHub user tadayosi opened a pull request:
https://github.com/apache/cxf/pull/187
[CXF-7109] ClientCallback may be invoked twice when Async HTTP Transport is
used
https://issues.apache.org/jira/browse/CXF-7109
I think the best way to make a client callback invoked once and only once
is to remove from the exchange immediately after its `handle***()` method is
invoked once. It should prevent a client callback from being called more than
once not only for the
[CXF-7109](https://issues.apache.org/jira/browse/CXF-7109) case but also for
any other potential cases where the callback may be invoked more than once
accidentally.
I added `remove(Class<T>)` to `Exchange` (`StringMap`) for convenience and
symmetry. It is necessary to remove the callback right before calling its
`handle***()`, as otherwise some other thread may grab it concurrently before
the current thread invokes `handle***()`.
I also added a test case
`AsyncHTTPConduitTest#testCallAsyncCallbackInvokedOnlyOnce()`, but please note
this test fails only on RHEL 6.8 even without this fix. In order to check if
this fix is really effective, you need to run the test on RHEL 6.8 to compare
the results.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/tadayosi/cxf CXF-7109
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cxf/pull/187.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #187
----
commit 4eb81d3044c0f663d580cdbd3b611d5e3b1b4ac5
Author: Tadayoshi Sato <[email protected]>
Date: 2016-10-25T09:45:42Z
[CXF-7109] ClientCallback may be invoked twice when Async HTTP Transport is
used
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---