Package org.apache.activemq.kaha

Examples of org.apache.activemq.kaha.StoreEntry


     * @param entry
     * @return the Object at that entry
     */
    public synchronized Object get(final StoreEntry entry) {
        load();
        StoreEntry entryToUse = refresh(entry);
        return getValue(entryToUse);
    }
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

        return result != null ? indexManager.getIndex(result.getIndexOffset()) : null;
    }

    public synchronized StoreEntry remove(Object key) throws IOException {
        load();
        StoreEntry result = null;
        HashEntry entry = new HashEntry();
        entry.setKey((Comparable)key);
        HashEntry he = getBin(key).remove(entry);
        if (he != null) {
            this.size--;
View Full Code Here

     * @param key
     * @return store entry
     * @see org.apache.activemq.kaha.impl.index.Index#removeKey(java.lang.Object)
     */
    public StoreEntry remove(Object key) {
        StoreEntry result = map.remove(key);
        if (result != null) {
            try {
                result = indexManager.refreshIndex((IndexItem)result);
            } catch (IOException e) {
                LOG.error("Failed to refresh entry", e);
View Full Code Here

    /**
     * @param key
     * @return the entry
     */
    public StoreEntry get(Object key) {
        StoreEntry result = map.get(key);
        if (result != null) {
            try {
                result = indexManager.refreshIndex((IndexItem)result);
            } catch (IOException e) {
                LOG.error("Failed to refresh entry", e);
View Full Code Here

     * @see org.apache.activemq.kaha.MapContainer#get(java.lang.Object)
     */
    public synchronized Object get(Object key) {
        load();
        Object result = null;
        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

     * @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

     */
    public synchronized Object removeLast() {
        if (size == 0) {
            return null;
        }
        StoreEntry result = last;
        remove(last);
        return result;
    }
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.