-
Notifications
You must be signed in to change notification settings - Fork 183
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
Permit copy for TestExecutor
AsyncContextMap
#1675
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scottmitch
reviewed
Jul 17, 2021
...icetalk-concurrent-api/src/testFixtures/java/io/servicetalk/concurrent/api/TestExecutor.java
Outdated
Show resolved
Hide resolved
tkountis
approved these changes
Jul 19, 2021
chemicL
approved these changes
Jul 19, 2021
Motivation: The TestExecutor was recently enhanced to install an invalid AsyncContextMap when executing Runnable tasks to check for tasks which did not properly save/restore the appropriate async context. The invalid map should allow itself to be copied, for usages which want to initiate a new subscribe operation. Modifications: copy() returns the same map rather than generating an exception. Result: Now possible to subscribe() within a Runnable without providing an `AsyncContextMap`.
890574d
to
97dd4b5
Compare
Scottmitch
approved these changes
Jul 19, 2021
bondolo
added a commit
to bondolo/servicetalk
that referenced
this pull request
Jul 27, 2021
Motivation: The earlier PR apple#1662 (and followon apple#1675), were intended to resolve issues with handling of AsyncContextMap and `TestExecutor.execute(Runnable)` but the nature of the problem was misunderstood. In those cases the observed problem was that causing tasks to execute using `TestExecutor.executeNextTask()` from a different thread than that which enqueued the task resulted in a new empty AsyncContextMap being used rather than the correct AsyncContextMap. The solution in apple#1662 was intended to detect the case where the map was not correctly being set by the wrapping of the Subscription or Subscriber in the operator chain. It missed that the behavior of TestExecutor was itself inconsistent with other ServiceTalk executors. Executors are supposed to propagate the AsyncContextMap from the thread invoking `Executor.execute()` to the thread which executes the `Runnable`. This behavior was missing in TestExecutor which originally did not set the AsyncContextMap and after apple#1662 set the map to an intentionally invalid map. Modifications: TestExecutor captures the active `AsyncContextMap` at task creation and when the task is eventually executed the `Runnable` is invoked with the same map active. Result: TestExecutor behavior matches other executors.
bondolo
added a commit
to bondolo/servicetalk
that referenced
this pull request
Jul 27, 2021
Motivation: The earlier PR apple#1662 (and followon apple#1675), were intended to resolve issues with handling of AsyncContextMap and `TestExecutor.execute(Runnable)` but the nature of the problem was misunderstood. In those cases the observed problem was that causing tasks to execute using `TestExecutor.executeNextTask()` from a different thread than that which enqueued the task resulted in a new empty AsyncContextMap being used rather than the correct AsyncContextMap. The solution in apple#1662 was intended to detect the case where the map was not correctly being set by the wrapping of the Subscription or Subscriber in the operator chain. It missed that the behavior of TestExecutor was itself inconsistent with other ServiceTalk executors. Executors are supposed to propagate the AsyncContextMap from the thread invoking `Executor.execute()` to the thread which executes the `Runnable`. This behavior was missing in TestExecutor which originally did not set the AsyncContextMap and after apple#1662 set the map to an intentionally invalid map. Modifications: TestExecutor captures the active `AsyncContextMap` at task creation and when the task is eventually executed the `Runnable` is invoked with the same map active. Result: TestExecutor behavior matches other executors.
bondolo
added a commit
that referenced
this pull request
Jul 28, 2021
Motivation: The earlier PR #1662 (and followon #1675), were intended to resolve issues with handling of AsyncContextMap and `TestExecutor.execute(Runnable)` but the nature of the problem was misunderstood. In those cases the observed problem was that causing tasks to execute using `TestExecutor.executeNextTask()` from a different thread than that which enqueued the task resulted in a new empty AsyncContextMap being used rather than the correct AsyncContextMap. The solution in #1662 was intended to detect the case where the map was not correctly being set by the wrapping of the Subscription or Subscriber in the operator chain. It missed that the behavior of TestExecutor was itself inconsistent with other ServiceTalk executors. Executors are supposed to propagate the AsyncContextMap from the thread invoking `Executor.execute()` to the thread which executes the `Runnable`. This behavior was missing in `TestExecutor` which originally did not set the `AsyncContextMap` and after #1662 set the map to an intentionally invalid map. Modifications: `TestExecutor` now captures the active `AsyncContextMap` at task creation and when the task is eventually executed the task `Runnable` is invoked with the same map active. Result: `TestExecutor` behavior now matches other executors.
bondolo
added a commit
to bondolo/servicetalk
that referenced
this pull request
Jul 28, 2021
Motivation: The `TestExecutor` was recently enhanced to install an invalid `AsyncContextMap` when executing `Runnable` tasks to check for tasks which did not properly save/restore the appropriate async context. The invalid map should allow itself to be copied, producing an empty map, for usages which want to initiate a new subscribe operation. Modifications: `copy()` returns a new empty map rather than generating an exception. Result: Now possible to subscribe() within a `Runnable` without providing an `AsyncContextMap`.
bondolo
added a commit
to bondolo/servicetalk
that referenced
this pull request
Jul 28, 2021
Motivation: The earlier PR apple#1662 (and followon apple#1675), were intended to resolve issues with handling of AsyncContextMap and `TestExecutor.execute(Runnable)` but the nature of the problem was misunderstood. In those cases the observed problem was that causing tasks to execute using `TestExecutor.executeNextTask()` from a different thread than that which enqueued the task resulted in a new empty AsyncContextMap being used rather than the correct AsyncContextMap. The solution in apple#1662 was intended to detect the case where the map was not correctly being set by the wrapping of the Subscription or Subscriber in the operator chain. It missed that the behavior of TestExecutor was itself inconsistent with other ServiceTalk executors. Executors are supposed to propagate the AsyncContextMap from the thread invoking `Executor.execute()` to the thread which executes the `Runnable`. This behavior was missing in `TestExecutor` which originally did not set the `AsyncContextMap` and after apple#1662 set the map to an intentionally invalid map. Modifications: `TestExecutor` now captures the active `AsyncContextMap` at task creation and when the task is eventually executed the task `Runnable` is invoked with the same map active. Result: `TestExecutor` behavior now matches other executors.
0.41 (cc76f15) |
bondolo
added a commit
to bondolo/servicetalk
that referenced
this pull request
Aug 27, 2021
Motivation: The `TestExecutor` was recently enhanced to install an invalid `AsyncContextMap` when executing `Runnable` tasks to check for tasks which did not properly save/restore the appropriate async context. The invalid map should allow itself to be copied, producing an empty map, for usages which want to initiate a new subscribe operation. Modifications: `copy()` returns a new empty map rather than generating an exception. Result: Now possible to subscribe() within a `Runnable` without providing an `AsyncContextMap`.
bondolo
added a commit
to bondolo/servicetalk
that referenced
this pull request
Aug 27, 2021
Motivation: The earlier PR apple#1662 (and followon apple#1675), were intended to resolve issues with handling of AsyncContextMap and `TestExecutor.execute(Runnable)` but the nature of the problem was misunderstood. In those cases the observed problem was that causing tasks to execute using `TestExecutor.executeNextTask()` from a different thread than that which enqueued the task resulted in a new empty AsyncContextMap being used rather than the correct AsyncContextMap. The solution in apple#1662 was intended to detect the case where the map was not correctly being set by the wrapping of the Subscription or Subscriber in the operator chain. It missed that the behavior of TestExecutor was itself inconsistent with other ServiceTalk executors. Executors are supposed to propagate the AsyncContextMap from the thread invoking `Executor.execute()` to the thread which executes the `Runnable`. This behavior was missing in `TestExecutor` which originally did not set the `AsyncContextMap` and after apple#1662 set the map to an intentionally invalid map. Modifications: `TestExecutor` now captures the active `AsyncContextMap` at task creation and when the task is eventually executed the task `Runnable` is invoked with the same map active. Result: `TestExecutor` behavior now matches other executors.
bondolo
added a commit
that referenced
this pull request
Aug 27, 2021
Motivation: The `TestExecutor` was recently enhanced to install an invalid `AsyncContextMap` when executing `Runnable` tasks to check for tasks which did not properly save/restore the appropriate async context. The invalid map should allow itself to be copied, producing an empty map, for usages which want to initiate a new subscribe operation. Modifications: `copy()` returns a new empty map rather than generating an exception. Result: Now possible to subscribe() within a `Runnable` without providing an `AsyncContextMap`.
bondolo
added a commit
that referenced
this pull request
Aug 27, 2021
Motivation: The earlier PR #1662 (and followon #1675), were intended to resolve issues with handling of AsyncContextMap and `TestExecutor.execute(Runnable)` but the nature of the problem was misunderstood. In those cases the observed problem was that causing tasks to execute using `TestExecutor.executeNextTask()` from a different thread than that which enqueued the task resulted in a new empty AsyncContextMap being used rather than the correct AsyncContextMap. The solution in #1662 was intended to detect the case where the map was not correctly being set by the wrapping of the Subscription or Subscriber in the operator chain. It missed that the behavior of TestExecutor was itself inconsistent with other ServiceTalk executors. Executors are supposed to propagate the AsyncContextMap from the thread invoking `Executor.execute()` to the thread which executes the `Runnable`. This behavior was missing in `TestExecutor` which originally did not set the `AsyncContextMap` and after #1662 set the map to an intentionally invalid map. Modifications: `TestExecutor` now captures the active `AsyncContextMap` at task creation and when the task is eventually executed the task `Runnable` is invoked with the same map active. Result: `TestExecutor` behavior now matches other executors.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As observed by @chemicL
Motivation:
The
TestExecutor
was recently enhanced to install an invalidAsyncContextMap
when executingRunnable
tasks to check for taskswhich did not properly save/restore the appropriate async context. The
invalid map should allow itself to be copied, producing an empty map,
for usages which want to initiate a new subscribe operation.
Modifications:
copy()
returns a new empty map rather than generating an exception.Result:
Now possible to subscribe() within a
Runnable
without providing anAsyncContextMap
.