We have been trying to use the InvocationContext to pass "out of band" information from the client to the server using the InvocationContext, populating and evaluating it in client-side and container-side interceptors. For local calls within JBoss, the concept is working as it should, but using a remote, clustered connection, the InvocationContext is lost and Invocation#getInvocationContext simply returns null on the container.
I've stepped through the JBoss code and found, that the reason for this is the use of MarshalledInvocation in the JRMPInvokerProxyHA proxy. Here, as a last step before the actual invocation is being performed, the original Invocation object as populated by our interceptor is converted into a MarshalledInvocation:
MarshalledInvocation mi = new MarshalledInvocation(invocation);
In the MarshalledInvocation(Invocation) constructor, it seems as if all the data from the original Invocation object is copied, except for the InvocationContext, hence resulting in a "null" context on the container side.
Is the context discarded on purpose, or is this a bug in the MarhsalledInvocation constructor?