1 14 15 package org.apache.activemq.broker.region.cursors; 16 17 import java.util.LinkedList ; 18 import org.apache.activemq.broker.ConnectionContext; 19 import org.apache.activemq.broker.region.Destination; 20 import org.apache.activemq.broker.region.MessageReference; 21 import org.apache.activemq.memory.UsageManager; 22 23 28 public class AbstractPendingMessageCursor implements PendingMessageCursor{ 29 protected int memoryUsageHighWaterMark = 90; 30 protected int maxBatchSize=100; 31 protected UsageManager usageManager; 32 33 public void start() throws Exception { 34 } 35 36 public void stop() throws Exception { 37 gc(); 38 } 39 40 public void add(ConnectionContext context,Destination destination) throws Exception { 41 } 42 43 public void remove(ConnectionContext context,Destination destination) throws Exception { 44 } 45 46 public boolean isRecoveryRequired(){ 47 return true; 48 } 49 50 public void addMessageFirst(MessageReference node) throws Exception { 51 } 52 53 public void addMessageLast(MessageReference node) throws Exception { 54 } 55 56 public void addRecoveredMessage(MessageReference node) throws Exception { 57 addMessageLast(node); 58 } 59 60 public void clear(){ 61 } 62 63 public boolean hasNext(){ 64 return false; 65 } 66 67 public boolean isEmpty(){ 68 return false; 69 } 70 71 public boolean isEmpty(Destination destination) { 72 return isEmpty(); 73 } 74 75 public MessageReference next(){ 76 return null; 77 } 78 79 public void remove(){ 80 } 81 82 public void reset(){ 83 } 84 85 public int size(){ 86 return 0; 87 } 88 89 public int getMaxBatchSize(){ 90 return maxBatchSize; 91 } 92 93 public void setMaxBatchSize(int maxBatchSize){ 94 this.maxBatchSize=maxBatchSize; 95 } 96 97 protected void fillBatch() throws Exception { 98 } 99 100 public void resetForGC(){ 101 reset(); 102 } 103 104 public void remove(MessageReference node){ 105 } 106 107 public void gc(){ 108 } 109 110 111 public void setUsageManager(UsageManager usageManager){ 112 this.usageManager = usageManager; 113 } 114 115 public boolean hasSpace() { 116 return usageManager != null ? (usageManager.getPercentUsage() < memoryUsageHighWaterMark): true; 117 } 118 119 public boolean isFull() { 120 return usageManager != null ? usageManager.isFull() : false; 121 } 122 123 124 public void release(){ 125 } 126 127 public boolean hasMessagesBufferedToDeliver() { 128 return false; 129 } 130 131 132 135 public int getMemoryUsageHighWaterMark(){ 136 return this.memoryUsageHighWaterMark; 137 } 138 139 140 143 public void setMemoryUsageHighWaterMark(int memoryUsageHighWaterMark){ 144 this.memoryUsageHighWaterMark=memoryUsageHighWaterMark; 145 } 146 147 148 151 public UsageManager getUsageManager(){ 152 return this.usageManager; 153 } 154 155 159 public void destroy() throws Exception { 160 stop(); 161 } 162 163 168 public LinkedList pageInList(int maxItems) { 169 throw new RuntimeException ("Not supported"); 170 } 171 } 172 | Popular Tags |