You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Shantanu Sen <ss...@pacbell.net> on 2005/01/22 02:46:56 UTC

Question on TypeMappingImpl of axis client on a multi-threaded env

We have a set of generated stubs talking to multiple web services. Our env is multithreaded and we are running on a multi cpu system. When a call comes in to each of our client (axis client stub) we are configuring the client so that each client uses a custom EngineConfiguration (basically a subclass of org.apache.axis.AxisEngine.SimpleProvider) which uses a custom transport handler to push the call to the service.

We were using a static class for the EngineConfiguration implementation. This worked fine on a multi-threaded env on a single CPU system, but on a multi cpu system we faced the following error.

At random, the types registered in the TypemappingRegistry would lose the mapping of a XML to Java type. This would typically occur when the client is trying to find a deserializer to deserialize a response. 

We are attributing it to the fact that TypeMappingImpl stores the mappings in HashMaps (qName2Pair, class2Pair etc), and hashmap is not thread safe. So it seems that TypeMappingImpl is designed to be used in a thread safe env which has to be ensured by the client.

Any pointers on this? Does the AXIS architecture warrant that when each thread instantiates a client, a new instance of EngineConfiguration is required so that the type mapping registry is thread safe? 

Thanks,

Shantanu Sen