View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
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  }