Can the javax.xml.soap.MessageFactory be reused?
I.e.
msgFactory = MessageFactory.newInstance();
Can I cache msgFactory and reuse it to create new SOAPMessages as needed?
Also should the msgFactory.createMessage();
be synchronized if it is ok to reuse msgFactory in the code?
UPDATE:
Also in single threaded-code, could I store msgFactory to create SOAPMessages over and over, so as not to create a new instance of MessageFactory each time
Thanks
MessageFactory
is thread-safe, since that's the convention, but it's hard to be 100% sure. – Gentlefolk