PDA

View Full Version : Is JmsTemplate102 Thread Safe



pdelahun
Mar 30th, 2005, 08:55 AM
Hi

Can i have a JmsTemplate102 instance variable that is used in a servlet... Or to say it another way is JmsTemplate102 thread safe like a datasource.

or should i do:

jt = new JmsTemplate102(connFactory, false);
jt.send(queue, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("hello queue world");
}
});

each time my service method is called.

Juergen Hoeller
Apr 14th, 2005, 02:25 PM
JmsTemplate102, like all of Spring's "template" classes, should be perfectly thread-safe. Hence, I recommend to hold it in instance variables.

Juergen

pdelahun
Apr 18th, 2005, 10:32 AM
Hi Juergen

Many thanks... i was hoping it worked just like the JDBCTemplate. Any plans to make the docs in spring a wiki... So that the community can add extra helpful info ?