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;
018
019import org.apache.activemq.command.MessageId;
020
021/**
022 * Provides basic audit functions for Messages
023 * 
024 * 
025 */
026public class ActiveMQMessageAudit extends ActiveMQMessageAuditNoSync {
027
028    private static final long serialVersionUID = 1L;
029
030    /**
031     * Default Constructor windowSize = 2048, maximumNumberOfProducersToTrack =
032     * 64
033     */
034    public ActiveMQMessageAudit() {
035        super();
036    }
037
038    /**
039     * Construct a MessageAudit
040     * 
041     * @param auditDepth range of ids to track
042     * @param maximumNumberOfProducersToTrack number of producers expected in
043     *                the system
044     */
045    public ActiveMQMessageAudit(int auditDepth, final int maximumNumberOfProducersToTrack) {
046        super(auditDepth, maximumNumberOfProducersToTrack);
047    }
048    
049    @Override
050    public boolean isDuplicate(String id) {
051        synchronized (this) {
052            return super.isDuplicate(id);
053        }
054    }
055
056    @Override
057    public boolean isDuplicate(final MessageId id) {
058        synchronized (this) {
059            return super.isDuplicate(id);
060        }
061    }
062
063    @Override
064    public void rollback(final  MessageId id) {
065        synchronized (this) {
066            super.rollback(id);
067        }
068    }
069    
070    @Override
071    public boolean isInOrder(final String id) {
072        synchronized (this) {
073            return super.isInOrder(id);
074        }
075    }
076    
077    @Override
078    public boolean isInOrder(final MessageId id) {
079        synchronized (this) {
080            return super.isInOrder(id);
081        }
082    }
083
084    public void setMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack) {
085        synchronized (this) {
086            super.setMaximumNumberOfProducersToTrack(maximumNumberOfProducersToTrack);
087        }
088    }
089}