Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/service/boundedvm/DurableMessagePointer.java


1   /** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * Copyright 2005 Hiram Chirino
5    * 
6    * Licensed under the Apache License, Version 2.0 (the "License"); 
7    * you may not use this file except in compliance with the License. 
8    * You may obtain a copy of the License at 
9    * 
10   * http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS, 
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
15   * See the License for the specific language governing permissions and 
16   * limitations under the License. 
17   * 
18   **/
19  package org.activemq.service.boundedvm;
20  
21  import javax.jms.JMSException;
22  
23  import org.activemq.io.util.MemoryManageable;
24  import org.activemq.message.ActiveMQDestination;
25  import org.activemq.message.ActiveMQMessage;
26  import org.activemq.store.MessageStore;
27  
28  /**
29   * DurableMessagePointers are moved around in the DurableQueueBoundedMessageManager
30   * so that we remember the associated messageStore that the message has been 
31   * persisted to.
32   * 
33   * @version $Revision: 1.1.1.1 $
34   */
35  public class DurableMessagePointer implements MemoryManageable {
36      
37      private final MessageStore messageStore;
38      private final ActiveMQMessage message;
39          
40      public DurableMessagePointer(MessageStore messageStore, ActiveMQDestination destination, ActiveMQMessage message) {
41          this.messageStore = messageStore;
42          this.message = message;
43      }
44  
45      public ActiveMQMessage getMessage() {
46          return message;
47      }
48  
49      public Object getMemoryId() {
50          return message.getMemoryId();
51      }
52  
53      public int getMemoryUsage() {
54          return message.getMemoryUsage();
55      }
56  
57      public int incrementMemoryReferenceCount() {
58          return message.incrementMemoryReferenceCount();
59      }
60  
61      public int decrementMemoryReferenceCount() {
62          return message.decrementMemoryReferenceCount();
63      }
64  
65      public int getMemoryUsageReferenceCount() {
66          return message.getMemoryUsageReferenceCount();
67      }
68      
69      public int incrementDeliveryCount() throws JMSException {
70          return message.incrementDeliveryCount();
71      }
72  
73      public int incrementRedeliveryCount() throws JMSException {
74          return message.incrementRedeliveryCount();
75      }
76  
77      /**
78       * @return Returns the messageStore.
79       */
80      public MessageStore getMessageStore() {
81          return messageStore;
82      }
83      
84      public String toString(){
85          return "DMP - msg = " +  message;
86      }
87      
88      public int getPriority() {
89        return message.getPriority();
90      }
91  }