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 | 0 | public class ReusableSessionWrapperFactory |
14 | |
{ |
15 | |
|
16 | |
public static Session createWrapper(Session session) |
17 | |
{ |
18 | 0 | if (session instanceof TopicSession) |
19 | |
{ |
20 | 0 | return new ReusableTopicSessionWrapper((TopicSession) session); |
21 | |
} |
22 | 0 | else if (session instanceof QueueSession) |
23 | |
{ |
24 | 0 | return new ReusableQueueSessionWrapper((javax.jms.QueueSession) session); |
25 | |
} |
26 | 0 | else if (session instanceof Session) |
27 | |
{ |
28 | 0 | return new ReusableSessionWrapper(session); |
29 | |
} |
30 | |
else |
31 | |
{ |
32 | 0 | throw new IllegalArgumentException("session type " + session.getClass() + " no supported as reusable"); |
33 | |
} |
34 | |
} |
35 | |
|
36 | |
} |