Package org.apache.activemq.kaha

Examples of org.apache.activemq.kaha.StoreEntry


     * @param key
     * @return the StoreEntry
     */
    public synchronized StoreEntry getEntry(Object key) {
        load();
        StoreEntry item = null;
        try {
            item = index.get(key);
        } catch (IOException e) {
            LOG.error("Failed trying to get key: " + key, e);
            throw new RuntimeException(e);
View Full Code Here


        this.root = root;
        this.indexManager = im;
        this.dataManager = dfm;
        long nextItem = root.getNextItem();
        while (nextItem != Item.POSITION_NOT_SET) {
            StoreEntry item = indexManager.getIndex(nextItem);
            StoreLocation data = item.getKeyDataItem();
            Object key = dataManager.readItem(ROOT_MARSHALLER, data);
            map.put(key, item);
            list.add(item);
            nextItem = item.getNextItem();
            dataManager.addInterestInFile(item.getKeyFile());
        }
    }
View Full Code Here

        list.add(newRoot);
        return containerRoot;
    }

    void removeRoot(IndexManager containerIndexManager, ContainerId key) throws IOException {
        StoreEntry oldRoot = map.remove(key);
        if (oldRoot != null) {
            dataManager.removeInterestInFile(oldRoot.getKeyFile());
            // get the container root
            IndexItem containerRoot = containerIndexManager.getIndex(oldRoot.getValueOffset());
            if (containerRoot != null) {
                containerIndexManager.freeIndex(containerRoot);
            }
            int index = list.indexOf(oldRoot);
            IndexItem prev = index > 0 ? (IndexItem)list.get(index - 1) : root;
View Full Code Here

            indexManager.freeIndex((IndexItem)oldRoot);
        }
    }

    IndexItem getRoot(IndexManager containerIndexManager, ContainerId key) throws IOException {
        StoreEntry index = map.get(key);
        if (index != null) {
            return containerIndexManager.getIndex(index.getValueOffset());
        }
        return null;
    }
View Full Code Here

    public void removeMessage(ConnectionContext context, MessageAck ack) throws IOException {
        removeMessage(ack.getLastMessageId());
    }

    public synchronized void removeMessage(MessageId msgId) throws IOException {
        StoreEntry entry = messageContainer.getEntry(msgId);
        if (entry != null) {
            messageContainer.remove(entry);
            if (messageContainer.isEmpty() || (batchEntry != null && batchEntry.equals(entry))) {
                resetBatching();
            }
View Full Code Here

     * @see org.apache.activemq.store.MessageStore#recoverNextMessages(org.apache.activemq.command.MessageId,
     *      int, org.apache.activemq.store.MessageRecoveryListener)
     */
    public synchronized void recoverNextMessages(int maxReturned, MessageRecoveryListener listener)
        throws Exception {
        StoreEntry entry = batchEntry;
        if (entry == null) {
            entry = messageContainer.getFirst();
        } else {
            entry = messageContainer.refresh(entry);
            entry = messageContainer.getNext(entry);
View Full Code Here

     */
    public synchronized StoreEntry removeFirst() {
        if (size == 0) {
            return null;
        }
        StoreEntry result = root.next;
        remove(root.next);
        return result;
    }
View Full Code Here

     */
    public synchronized Object removeLast() {
        if (size == 0) {
            return null;
        }
        StoreEntry result = root.prev;
        remove(root.prev);
        return result;
    }
View Full Code Here

     *
     * @param object
     * @return the entry in the Store
     */
    public synchronized StoreEntry placeLast(Object object) {
        StoreEntry item = internalAddLast(object);
        return item;
    }
View Full Code Here

     *
     * @param object
     * @return the location in the Store
     */
    public synchronized StoreEntry placeFirst(Object object) {
        StoreEntry item = internalAddFirst(object);
        return item;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.kaha.StoreEntry

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.