Results 1 to 3 of 3

Thread: Is JmsTemplate102 Thread Safe

  1. #1
    Join Date
    Mar 2005
    Posts
    9

    Default Is JmsTemplate102 Thread Safe

    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.

  2. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    JmsTemplate102, like all of Spring's "template" classes, should be perfectly thread-safe. Hence, I recommend to hold it in instance variables.

    Juergen

  3. #3
    Join Date
    Mar 2005
    Posts
    9

    Default Many thanks

    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 ?

Similar Threads

  1. application context - thread safe?
    By jesion in forum Container
    Replies: 3
    Last Post: Apr 18th, 2008, 07:27 AM
  2. MimeMessagePreparator thread safe issue
    By wfcheang in forum Container
    Replies: 3
    Last Post: Aug 23rd, 2005, 10:58 AM
  3. Replies: 10
    Last Post: Jul 8th, 2005, 02:24 AM
  4. Sessions closing after commit
    By bendg25 in forum Data
    Replies: 0
    Last Post: Mar 21st, 2005, 04:38 AM
  5. Is Spring singletn thread safe?
    By rodean in forum Container
    Replies: 1
    Last Post: Dec 1st, 2004, 05:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •