Simon Laws wrote:
..snip
For 2), the component implementation could modify the same
"data transfer" object and this object would be accessible to the
reference interceptors/handlers. If we defer the point where the
Message object gets switched, the reference interceptors/handlers
would also have access to the inbound Message (as well as to the
under-construction outbound Message) if they need it.
Sounds OK, I still haven't got to the bottom of why we need the switch
but I haven't looked at all of the end to end picture yet.
>
We need the switch when a reference in component A invokes a service
in component B locally on the same JVM thread. Without the switch,
component B's implementation would see the same inbound Message as
component A's implementation.
At present we do the switch in JDKInvocationHandler when component A
makes a reference invocation. Instead, I think we could do the switch
when component B's service is dispatched. The service dispatch always
needs to put the Message into the thread context so that it's accessible
to the service implementation code. When B's service invocation returns
back to the dispatcher, the Message for B's service invocation would be
discarded and the Message for A's service invocation would be restored.
Simon