1
2
3
4
5
6
7 package org.mule.transport.jms;
8
9 import javax.jms.QueueSession;
10 import javax.jms.Session;
11 import javax.jms.TopicSession;
12
13 public class ReusableSessionWrapperFactory
14 {
15
16 public static Session createWrapper(Session session)
17 {
18 if (session instanceof TopicSession)
19 {
20 return new ReusableTopicSessionWrapper((TopicSession) session);
21 }
22 else if (session instanceof QueueSession)
23 {
24 return new ReusableQueueSessionWrapper((javax.jms.QueueSession) session);
25 }
26 else if (session instanceof Session)
27 {
28 return new ReusableSessionWrapper(session);
29 }
30 else
31 {
32 throw new IllegalArgumentException("session type " + session.getClass() + " no supported as reusable");
33 }
34 }
35
36 }