Class RequestContext

  • All Implemented Interfaces:
    DistributedPropertySet, PropertySet

    public final class RequestContext
    extends BaseDistributedPropertySet
    Request context implementation.

    Why a custom map?

    The JAX-WS spec exposes properties as a Map, but if we just use an ordinary HashMap for this, it doesn't work as fast as we'd like it to be. Hence we have this class.

    We expect the user to set a few properties and then use that same setting to make a bunch of invocations. So we'd like to take some hit when the user actually sets a property to do some computation, then use that computed value during a method invocation again and again.

    For this goal, we use PropertySet and implement some properties as virtual properties backed by methods. This allows us to do the computation in the setter, and store it in a field.

    These fields are used by Stub.process(com.sun.xml.ws.api.message.Packet, com.sun.xml.ws.client.RequestContext, com.sun.xml.ws.client.ResponseContextReceiver) to populate a Packet.

    How it works?

    For better performance, we wan't use strongly typed field as much as possible to avoid reflection and unnecessary collection iterations; Using BasePropertySet.MapView implementation allows client to use Map interface in a way that all the strongly typed properties are reflected to the fields right away. Any additional (extending) properties can be added by client as well; those would be processed using iterating the MapView and their processing, of course, would be slower.

    The previous implementation with fallback mode has been removed to simplify the code and remove the bugs.

    Author:
    Kohsuke Kawaguchi