Package org.apache.activemq.store.ReferenceStore

Examples of org.apache.activemq.store.ReferenceStore.ReferenceData


            });
        }
    }

    final void addMessage(final Message message, final Location location) throws InterruptedIOException {
        ReferenceData data = new ReferenceData();
        data.setExpiration(message.getExpiration());
        data.setFileId(location.getDataFileId());
        data.setOffset(location.getOffset());
        synchronized (this) {
            lastLocation = location;
            messages.put(message.getMessageId(), data);
            this.peristenceAdapter.addInProgressDataFile(this, location.getDataFileId());
        }
View Full Code Here


    public boolean replayAddMessage(ConnectionContext context, Message message, Location location) {
        MessageId id = message.getMessageId();
        try {
            // Only add the message if it has not already been added.
            ReferenceData data = referenceStore.getMessageReference(id);
            if (data == null) {
                data = new ReferenceData();
                data.setExpiration(message.getExpiration());
                data.setFileId(location.getDataFileId());
                data.setOffset(location.getOffset());
                referenceStore.addMessageReference(context, id, data);
                return true;
            }
        } catch (Throwable e) {
            LOG.warn("Could not replay add for message '" + id + "'.  Message may have already been added. reason: " + e, e);
View Full Code Here

            });
        }
    }

    final void removeMessage(final MessageAck ack, final Location location) throws InterruptedIOException {
        ReferenceData data;
        synchronized (this) {
            lastLocation = location;
            MessageId id = ack.getLastMessageId();
            data = messages.remove(id);
            if (data == null) {
View Full Code Here

    }
     
    public boolean replayRemoveMessage(ConnectionContext context, MessageAck messageAck) {
        try {
            // Only remove the message if it has not already been removed.
            ReferenceData t = referenceStore.getMessageReference(messageAck.getLastMessageId());
            if (t != null) {
                referenceStore.removeMessage(context, messageAck);
                return true;
            }
        } catch (Throwable e) {
View Full Code Here

        }
        return null;
    }
   
    protected Location getLocation(MessageId messageId) throws IOException {
        ReferenceData data = null;
        synchronized (this) {
            // Is it still in flight???
            data = messages.get(messageId);
            if (data == null && cpAddedMessageIds != null) {
                data = cpAddedMessageIds.get(messageId);
            }
        }
        if (data == null) {
            data = referenceStore.getMessageReference(messageId);
            if (data == null) {
                return null;
            }
        }
        Location location = new Location();
        location.setDataFileId(data.getFileId());
        location.setOffset(data.getOffset());
        return location;
    }
View Full Code Here

            });
        }
    }

    final void addMessage(final Message message, final Location location) throws InterruptedIOException {
        ReferenceData data = new ReferenceData();
        data.setExpiration(message.getExpiration());
        data.setFileId(location.getDataFileId());
        data.setOffset(location.getOffset());
         lock.lock();
         try {
            lastLocation = location;
            messages.put(message.getMessageId(), data);
        }finally {
View Full Code Here

    public boolean replayAddMessage(ConnectionContext context, Message message, Location location) {
        MessageId id = message.getMessageId();
        try {
            // Only add the message if it has not already been added.
            ReferenceData data = referenceStore.getMessageReference(id);
            if (data == null) {
                data = new ReferenceData();
                data.setExpiration(message.getExpiration());
                data.setFileId(location.getDataFileId());
                data.setOffset(location.getOffset());
                referenceStore.addMessageReference(context, id, data);
                return true;
            }
        } catch (Throwable e) {
            LOG.warn("Could not replay add for message '" + id + "'.  Message may have already been added. reason: " + e, e);
View Full Code Here

            });
        }
    }

    final void removeMessage(final MessageAck ack, final Location location) throws InterruptedIOException {
        ReferenceData data;
        lock.lock();
        try{
            lastLocation = location;
            MessageId id = ack.getLastMessageId();
            data = messages.remove(id);
            if (data == null) {
                messageAcks.add(ack);
            } else {
                // message never got written so datafileReference will still exist
                AMQMessageStore.this.peristenceAdapter.removeInProgressDataFile(AMQMessageStore.this, data.getFileId());
            }
        }finally {
            lock.unlock();
        }
        if (messageAcks.size() > this.peristenceAdapter.getMaxCheckpointMessageAddSize()) {
View Full Code Here

    }
     
    public boolean replayRemoveMessage(ConnectionContext context, MessageAck messageAck) {
        try {
            // Only remove the message if it has not already been removed.
            ReferenceData t = referenceStore.getMessageReference(messageAck.getLastMessageId());
            if (t != null) {
                referenceStore.removeMessage(context, messageAck);
                return true;
            }
        } catch (Throwable e) {
View Full Code Here

        }
        return null;
    }
   
    protected Location getLocation(MessageId messageId) throws IOException {
        ReferenceData data = null;
        lock.lock();
        try {
            // Is it still in flight???
            data = messages.get(messageId);
            if (data == null && cpAddedMessageIds != null) {
                data = cpAddedMessageIds.get(messageId);
            }
        }finally {
            lock.unlock();
        }
        if (data == null) {
            data = referenceStore.getMessageReference(messageId);
            if (data == null) {
                return null;
            }
        }
        Location location = new Location();
        location.setDataFileId(data.getFileId());
        location.setOffset(data.getOffset());
        return location;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.store.ReferenceStore.ReferenceData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.