No, the issue is the endpoint using whether the oldClassLoader
is null as the state variable meaning "beforeDeliveryInvoked".
In the case where the caller has no context classloader
(this came up where c threads are attached to the VM via JNI)
this test fails, because it thinks beforeDelivery wasn't invoked.
It just needs a seperate boolean "beforeDeliveryInvoked"
which it can check in afterDelivery().
Ok, easy enough. So, to 'reclarify'
1) Simply add a state variable to the MessageEndpointInterceptor to say whether or not beforeDelivery was invoked.
2)Check variable in afterDelivery.
Should have also said that the variable needs to also be checked in the beforeDelivery method and replace the check of the oldCL.