Clover coverage report - Lingo - 1.0-SNAPSHOT
Coverage timestamp: Fri May 13 2005 08:50:34 BST
file stats: LOC: 73   Methods: 6
NCLOC: 39   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
JmsProducerImpl.java 0% 26.7% 50% 28%
coverage coverage
 1   
 /** 
 2   
  * 
 3   
  * Copyright 2005 LogicBlaze, Inc.
 4   
  * 
 5   
  * Licensed under the Apache License, Version 2.0 (the "License"); 
 6   
  * you may not use this file except in compliance with the License. 
 7   
  * You may obtain a copy of the License at 
 8   
  * 
 9   
  * http://www.apache.org/licenses/LICENSE-2.0
 10   
  * 
 11   
  * Unless required by applicable law or agreed to in writing, software
 12   
  * distributed under the License is distributed on an "AS IS" BASIS, 
 13   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 14   
  * See the License for the specific language governing permissions and 
 15   
  * limitations under the License. 
 16   
  * 
 17   
  **/
 18   
 package org.logicblaze.lingo.jms.impl;
 19   
 
 20   
 import org.logicblaze.lingo.jms.JmsProducer;
 21   
 import org.springframework.beans.factory.DisposableBean;
 22   
 
 23   
 import javax.jms.JMSException;
 24   
 import javax.jms.MessageProducer;
 25   
 import javax.jms.Session;
 26   
 
 27   
 /**
 28   
  * An implementation of the {@link org.logicblaze.lingo.jms.JmsProducer} which is designed to work in
 29   
  * message driven POJO type scenarios where the session and producer can be deduced
 30   
  * from the current consumption thread & the session can be reused from the consumer.
 31   
  *
 32   
  * @version $Revision: 1.1 $
 33   
  */
 34   
 public class JmsProducerImpl implements JmsProducer, DisposableBean {
 35   
     private Session session;
 36   
     private MessageProducer producer;
 37   
 
 38  0
     public JmsProducerImpl(Session session) throws JMSException {
 39  0
         this.session = session;
 40  0
         this.producer = session.createProducer(null);
 41   
     }
 42   
 
 43  46
     public JmsProducerImpl(Session session, MessageProducer producer) {
 44  46
         this.session = session;
 45  46
         this.producer = producer;
 46   
     }
 47   
 
 48  202
     public Session getSession() {
 49  202
         return session;
 50   
     }
 51   
 
 52  188
     public MessageProducer getMessageProducer() {
 53  188
         return producer;
 54   
     }
 55   
 
 56  0
     public void close() throws JMSException {
 57  0
         if (producer != null) {
 58  0
             MessageProducer tmp = producer;
 59  0
             producer = null;
 60  0
             tmp.close();
 61   
         }
 62  0
         if (session != null) {
 63  0
             Session tmp = session;
 64  0
             session = null;
 65  0
             tmp.close();
 66   
         }
 67   
     }
 68   
 
 69  0
     public void destroy() throws Exception {
 70  0
         close();
 71   
     }
 72   
 }
 73