1 22 package org.jboss.mq.server; 23 24 import javax.jms.JMSException ; 25 26 import org.jboss.mq.SpyDestination; 27 import org.jboss.mq.SpyJMSException; 28 import org.jboss.mq.pm.Tx; 29 30 36 37 public class PersistentQueue extends org.jboss.mq.server.BasicQueue 38 { 39 SpyDestination destination; 40 41 public PersistentQueue(JMSDestinationManager server, SpyDestination destination, BasicQueueParameters parameters) throws JMSException 42 { 43 super(server, destination.toString(), parameters); 44 this.destination = destination; 45 } 46 47 public SpyDestination getSpyDestination() 48 { 49 return destination; 50 } 51 52 public void addMessage(MessageReference mesRef, Tx txId) throws JMSException 53 { 54 if (mesRef.isPersistent()) 55 { 56 try 57 { 58 server.getPersistenceManager().add(mesRef, txId); 59 } 60 catch (Throwable t) 61 { 62 String error = "Error storing message: " + mesRef; 63 log.debug(error, t); 64 try 65 { 66 server.getMessageCache().remove(mesRef); 67 } 68 catch (Throwable ignored) 69 { 70 log.trace("Ignored error while removing from cache.", ignored); 71 } 72 SpyJMSException.rethrowAsJMSException(error, t); 73 } 74 } 75 76 super.addMessage(mesRef, txId); 77 } 78 } 79 | Popular Tags |