Four Stars

tHash (output, input) not safe Thread :: karaf 404



I have implemented many simple cxf WS, using tHash components

When deploying the WS in Karaf and calling the WS, i get 404 error

Reported by Talend support : this is due to the fact that Karaf runs in multi-threaded environment, while tHash components are not safe thread

tHash component are major components in all cxf development, but i am told by the support, that they cannot be used in multi-thred environment

..that implyes that i cannot deploy cxf WS containing tHash component in Karaf


What can replace tHash compnoent in cxf develompent?

  • ESB

Re: tHash (output, input) not safe Thread :: karaf 404

It all depends on the logic of your webservices.  Hence, there is no silver bullet answer.  You should not use the tHash components in services.  Hence, you should think of designing differently.  The tHash components are built on the batch paradigm, i.e. cache hundreds of thousands of records in memory.  You do not want to do that in a service.  In a service, you process messages 1 at a time since each service call is for 1 soap message.  Hence, you will need to think about it from that perspective.  

 Do you have sample screenshots and data volume for your services?  Can you use globalMap for example?  Maybe use pid, which is the process id, and is different for each threads in the naming of your variables.  And make sure you set all your globalMap and other variables to null at the end of your processing for each thread.