View Javadoc

1   /*
2    * $Id: WebsphereTransactedJmsMessageReceiver.java 12139 2008-06-24 12:22:25Z dirk.olmes $
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.transport.jms.websphere;
12  
13  import org.mule.api.endpoint.InboundEndpoint;
14  import org.mule.api.lifecycle.CreateException;
15  import org.mule.api.lifecycle.InitialisationException;
16  import org.mule.api.service.Service;
17  import org.mule.api.transport.Connector;
18  import org.mule.transport.jms.XaTransactedJmsMessageReceiver;
19  
20  import javax.jms.Session;
21  
22  public class WebsphereTransactedJmsMessageReceiver extends XaTransactedJmsMessageReceiver
23  {
24      public WebsphereTransactedJmsMessageReceiver(Connector umoConnector, Service service, 
25          InboundEndpoint endpoint) throws InitialisationException, CreateException
26      {
27          super(umoConnector, service, endpoint);
28      }
29      
30      protected void doConnect() throws Exception
31      {
32          if (connector.isConnected() && connector.isEagerConsumer())
33          {
34              createConsumer();
35          }
36          
37          // MULE-1150 check whether mule is really connected    
38          if (connector.isConnected() && !this.connected.get() && connector.getSessionFromTransaction() == null)
39          {
40              // check connection by creating session
41              Session s = connector.getConnection().createSession(false, 1);
42              s.close();
43          }
44      }
45  }
46  
47