View Javadoc

1   /*
2    * $Id: WebsphereTransactedJmsMessageReceiver.java 9964 2007-12-03 14:48:45Z aperepel $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers.jms.websphere;
12  
13  import org.mule.providers.jms.XaTransactedJmsMessageReceiver;
14  import org.mule.umo.UMOComponent;
15  import org.mule.umo.endpoint.UMOEndpoint;
16  import org.mule.umo.lifecycle.InitialisationException;
17  import org.mule.umo.provider.UMOConnector;
18  
19  import javax.jms.Session;
20  
21  public class WebsphereTransactedJmsMessageReceiver extends XaTransactedJmsMessageReceiver
22  {
23  
24      public WebsphereTransactedJmsMessageReceiver(UMOConnector umoConnector, UMOComponent component, UMOEndpoint endpoint) throws InitialisationException
25      {
26          super(umoConnector, component, endpoint);
27      }
28      
29      protected void doConnect() throws Exception
30      {
31          if (connector.isConnected() && connector.isEagerConsumer())
32          {
33              createConsumer();
34          }
35          
36          // MULE-1150 check whether mule is really connected      
37          if (connector.isConnected() && !this.connected.get() && connector.getSessionFromTransaction() == null)
38          {
39              // check connection by creating session
40              Session s = connector.getConnection().createSession(false, 1);
41              s.close();
42          }
43      }
44  }