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    @Override
033    public void drop() {
034        throw new RuntimeException("not implemented");
035    }
036
037    @Override
038    public synchronized boolean dropIfLive() {
039        throw new RuntimeException("not implemented");
040    }
041
042    @Override
043    public LockOwner getLockOwner() {
044        throw new RuntimeException("not implemented");
045    }
046
047    @Override
048    public boolean isAcked() {
049        return false;
050    }
051
052    @Override
053    public boolean isDropped() {
054        return false;
055    }
056
057    @Override
058    public boolean lock(LockOwner subscription) {
059        return true;
060    }
061
062    @Override
063    public void setAcked(boolean b) {
064        throw new RuntimeException("not implemented");
065    }
066
067    @Override
068    public boolean unlock() {
069        return true;
070    }
071
072    @Override
073    public int decrementReferenceCount() {
074        return --references;
075    }
076
077    @Override
078    public long getExpiration() {
079        throw new RuntimeException("not implemented");
080    }
081
082    @Override
083    public String getGroupID() {
084        return null;
085    }
086
087    @Override
088    public int getGroupSequence() {
089        return 0;
090    }
091
092    @Override
093    public Message getMessage()  {
094        return message;
095    }
096
097    @Override
098    public Message getMessageHardRef() {
099        throw new RuntimeException("not implemented");
100    }
101
102    @Override
103    public MessageId getMessageId() {
104        return message.getMessageId();
105    }
106
107    @Override
108    public int getRedeliveryCounter() {
109        throw new RuntimeException("not implemented");
110    }
111
112    @Override
113    public int getReferenceCount() {
114        return references;
115    }
116
117    @Override
118    public Destination getRegionDestination() {
119        return null;
120    }
121
122    @Override
123    public int getSize() {
124        throw new RuntimeException("not implemented");
125    }
126
127    @Override
128    public ConsumerId getTargetConsumerId() {
129        throw new RuntimeException("not implemented");
130    }
131
132    @Override
133    public void incrementRedeliveryCounter() {
134        throw new RuntimeException("not implemented");
135    }
136
137    @Override
138    public int incrementReferenceCount() {
139        return ++references;
140    }
141
142    @Override
143    public boolean isExpired() {
144        return false;
145    }
146
147    @Override
148    public boolean isPersistent() {
149        throw new RuntimeException("not implemented");
150    }
151
152    @Override
153    public boolean isAdvisory() {
154        return false;
155    }
156
157    @Override
158    public boolean canProcessAsExpired() {
159        return false;
160    }
161
162}