Examples of IndexItem


Examples of org.apache.activemq.kaha.impl.index.IndexItem

    public synchronized boolean removeValue(Object o) {
        load();
        boolean result = false;
        if (o != null) {
            IndexItem item = indexList.getFirst();
            while (item != null) {
                Object value = getValue(item);
                if (value != null && value.equals(o)) {
                    result = true;
                    // find the key
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

     */
    public synchronized StoreEntry place(Object key, Object value) {
        load();
        try {
            remove(key);
            IndexItem item = write(key, value);
            index.store(key, item);
            indexList.add(item);
            return item;
        } catch (IOException e) {
            LOG.error("Failed trying to place key: " + key, e);
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

     * @param entry
     * @throws IOException
     */
    public synchronized void remove(StoreEntry entry) {
        load();
        IndexItem item = (IndexItem)entry;
        if (item != null) {
            Object key = getKey(item);
            try {
                index.remove(key);
            } catch (IOException e) {
                LOG.error("Failed trying to remove entry: " + entry, e);
                throw new RuntimeException(e);
            }
            IndexItem prev = indexList.getPrevEntry(item);
            IndexItem next = indexList.getNextEntry(item);
            indexList.remove(item);
            delete(item, prev, next);
        }
    }
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

        containerId.setDataContainerName(containerName);
        MapContainerImpl result = maps.get(containerId);
        if (result == null) {
            DataManager dm = getDataManager(containerName);
            IndexManager im = getIndexManager(dm, containerName);
            IndexItem root = mapsContainer.getRoot(im, containerId);
            if (root == null) {
                root = mapsContainer.addRoot(im, containerId);
            }
            result = new MapContainerImpl(directory, containerId, root, im, dm, persistentIndex);
            maps.put(containerId, result);
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

        ListContainerImpl result = lists.get(containerId);
        if (result == null) {
            DataManager dm = getDataManager(containerName);
            IndexManager im = getIndexManager(dm, containerName);

            IndexItem root = listsContainer.getRoot(im, containerId);
            if (root == null) {
                root = listsContainer.addRoot(im, containerId);
            }
            result = new ListContainerImpl(containerId, root, im, dm, persistentIndex);
            lists.put(containerId, result);
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

            LOG.info("Kaha Store using data directory " + directory);
            lockFile = new RandomAccessFile(new File(directory, "lock"), "rw");
            lock();
            DataManager defaultDM = getDataManager(defaultContainerName);
            rootIndexManager = getIndexManager(defaultDM, defaultContainerName);
            IndexItem mapRoot = new IndexItem();
            IndexItem listRoot = new IndexItem();
            if (rootIndexManager.isEmpty()) {
                mapRoot.setOffset(0);
                rootIndexManager.storeIndex(mapRoot);
                listRoot.setOffset(IndexItem.INDEX_SIZE);
                rootIndexManager.storeIndex(listRoot);
                rootIndexManager.setLength(IndexItem.INDEX_SIZE * 2);
            } else {
                mapRoot = rootIndexManager.getIndex(0);
                listRoot = rootIndexManager.getIndex(IndexItem.INDEX_SIZE);
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

    private void generateInterestInListDataFiles() throws IOException {
        for (Iterator i = listsContainer.getKeys().iterator(); i.hasNext();) {
            ContainerId id = (ContainerId)i.next();
            DataManager dm = getDataManager(id.getDataContainerName());
            IndexManager im = getIndexManager(dm, id.getDataContainerName());
            IndexItem theRoot = listsContainer.getRoot(im, id);
            long nextItem = theRoot.getNextItem();
            while (nextItem != Item.POSITION_NOT_SET) {
                IndexItem item = im.getIndex(nextItem);
                item.setOffset(nextItem);
                dm.addInterestInFile(item.getKeyFile());
                dm.addInterestInFile(item.getValueFile());
                nextItem = item.getNextItem();
            }
        }
    }
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

    private void generateInterestInMapDataFiles() throws IOException {
        for (Iterator i = mapsContainer.getKeys().iterator(); i.hasNext();) {
            ContainerId id = (ContainerId)i.next();
            DataManager dm = getDataManager(id.getDataContainerName());
            IndexManager im = getIndexManager(dm, id.getDataContainerName());
            IndexItem theRoot = mapsContainer.getRoot(im, id);
            long nextItem = theRoot.getNextItem();
            while (nextItem != Item.POSITION_NOT_SET) {
                IndexItem item = im.getIndex(nextItem);
                item.setOffset(nextItem);
                dm.addInterestInFile(item.getKeyFile());
                dm.addInterestInFile(item.getValueFile());
                nextItem = item.getNextItem();
            }

        }
    }
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

        return indexList.getLast();
    }

    public synchronized StoreEntry getNext(StoreEntry entry) {
        load();
        IndexItem item = (IndexItem)entry;
        return indexList.getNextEntry(item);
    }
View Full Code Here

Examples of org.apache.activemq.kaha.impl.index.IndexItem

        return indexList.getNextEntry(item);
    }

    public synchronized StoreEntry getPrevious(StoreEntry entry) {
        load();
        IndexItem item = (IndexItem)entry;
        return indexList.getPrevEntry(item);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.