1 Reply Latest reply on Jan 5, 2011 9:40 PM by mpokorny

    Comments about thread safety of River and co


      I have started using JBoss Marshalling packages particular the river implementation.


      My superficial understanding seems to make me confident that caching and pooling Marshaller/Unmarshaller instanceswould help performance and should not be a problem w/ River. A brief overview of the source of River seems to make me confident in saying that the internals are probably thread safe but a definitive statement in a blog or perhaps in javadoc etc would help me and others feel more confident in how it can and should be used. I am only bringing up via this form because i could not find anything on the matter searching the class sources or via Google.


      For my own endeavours I plain to add a pooling layer on top so i can pool Marshaller/UnMarshaller instances so the caches are kept and maximum performance becomes possible.


      Thanks David for a great idea and implementation.

        • 1. Re: Comments about thread safety of River and co

          I had more of a look and it probably does not make sense to cache marshallers/unmarshallers because they hold a map of instances which is used to avoid duplicate serialization of the same instance.


          Still i am interested why class caching is part of the marshaller/unmarshaller and there is no provision to perhaps to keep the cache for the next unmarshall attempt. My view is that a serializer would probably often always be deserializing instances of the same type even if they have different values.