001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.activemq.broker.region; 018 019import org.apache.activemq.command.ActiveMQMessage; 020import org.apache.activemq.command.ConsumerId; 021import org.apache.activemq.command.Message; 022import org.apache.activemq.command.MessageId; 023 024/** 025 * Used by the {@link QueueMessageReference#NULL_MESSAGE} 026 */ 027public final class NullMessageReference implements QueueMessageReference { 028 029 private final ActiveMQMessage message = new ActiveMQMessage(); 030 private volatile int references; 031 032 public void drop() { 033 throw new RuntimeException("not implemented"); 034 } 035 036 public LockOwner getLockOwner() { 037 throw new RuntimeException("not implemented"); 038 } 039 040 public boolean isAcked() { 041 return false; 042 } 043 044 public boolean isDropped() { 045 return false; 046 } 047 048 public boolean lock(LockOwner subscription) { 049 return true; 050 } 051 052 public void setAcked(boolean b) { 053 throw new RuntimeException("not implemented"); 054 } 055 056 public boolean unlock() { 057 return true; 058 } 059 060 public int decrementReferenceCount() { 061 return --references; 062 } 063 064 public long getExpiration() { 065 throw new RuntimeException("not implemented"); 066 } 067 068 public String getGroupID() { 069 return null; 070 } 071 072 public int getGroupSequence() { 073 return 0; 074 } 075 076 public Message getMessage() { 077 return message; 078 } 079 080 public Message getMessageHardRef() { 081 throw new RuntimeException("not implemented"); 082 } 083 084 public MessageId getMessageId() { 085 return message.getMessageId(); 086 } 087 088 public int getRedeliveryCounter() { 089 throw new RuntimeException("not implemented"); 090 } 091 092 public int getReferenceCount() { 093 return references; 094 } 095 096 public Destination getRegionDestination() { 097 return null; 098 } 099 100 public int getSize() { 101 throw new RuntimeException("not implemented"); 102 } 103 104 public ConsumerId getTargetConsumerId() { 105 throw new RuntimeException("not implemented"); 106 } 107 108 public void incrementRedeliveryCounter() { 109 throw new RuntimeException("not implemented"); 110 } 111 112 public int incrementReferenceCount() { 113 return ++references; 114 } 115 116 public boolean isExpired() { 117 return false; 118 } 119 120 public boolean isPersistent() { 121 throw new RuntimeException("not implemented"); 122 } 123 124 public boolean isAdvisory() { 125 return false; 126 } 127 128 @Override 129 public boolean canProcessAsExpired() { 130 return false; 131 } 132 133}