Hello

I have a customer who sent me a pair of applications with the following behaviour (see also the attached flow diagram):

  1. A request is sent to a REST resource in Application A
  2. The endpoint makes a RMI call to ServiceB in Application B
  3. ServiceB makes an RMI to ServiceA in Application A
  4. ServiceA makes an RMI to ServiceB in Application B
  5. ServiceB calls back to the rest resource.
A @RequestScoped bean is injected into the REST Resource and Service A.

The customer has noticed the same instance of that bean is injected into both injection points. They believe the two should be separate request scoped contexts.


The CDI spec says the request context is alive :
But it is not clear what happens if a remote method invocation is nested inside a service() method. Is that a separate request context or the same as the parent?


If they are seperate contexts, I notice that WeldInitialListener.requestInitialized requires a ServletRequestEvent, which would be tricky to acquire as part of processing an EJB remote method invocation. Would I need to find a way to access a ServletRequestEvent when creating the request context for a RMI?


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU