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