Package org.apache.activemq.kaha.impl.container

Examples of org.apache.activemq.kaha.impl.container.ListContainerImpl


        initialize();
        String containerName = IOHelper.toFileSystemSafeName(originalContainerName);
        ContainerId containerId = new ContainerId();
        containerId.setKey(id);
        containerId.setDataContainerName(containerName);
        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);
        }
        return result;
    }
View Full Code Here


        deleteListContainer(containerId);
    }

    public synchronized void deleteListContainer(ContainerId containerId) throws IOException {
        initialize();
        ListContainerImpl container = lists.remove(containerId);
        if (container != null) {
            listsContainer.removeRoot(container.getIndexManager(), containerId);
            container.clear();
            container.close();
        }
    }
View Full Code Here

        initialize();
        String containerName = IOHelper.toFileSystemSafeName(originalContainerName);
        ContainerId containerId = new ContainerId();
        containerId.setKey(id);
        containerId.setDataContainerName(containerName);
        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);
        }
        return result;
    }
View Full Code Here

        deleteListContainer(containerId);
    }

    public synchronized void deleteListContainer(ContainerId containerId) throws IOException {
        initialize();
        ListContainerImpl container = lists.remove(containerId);
        if (container != null) {
            listsContainer.removeRoot(container.getIndexManager(), containerId);
            container.clear();
            container.close();
        }
    }
View Full Code Here

    public synchronized ListContainer getListContainer(Object id, String containerName,
                                                       boolean persistentIndex) throws IOException {
        initialize();
        ContainerId containerId = new ContainerId(id, containerName);
        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);
        }
        return result;
    }
View Full Code Here

        deleteListContainer(containerId);
    }

    public synchronized void deleteListContainer(ContainerId containerId) throws IOException {
        initialize();
        ListContainerImpl container = lists.remove(containerId);
        if (container != null) {
            listsContainer.removeRoot(container.getIndexManager(), containerId);
            container.clear();
            container.close();
        }
    }
View Full Code Here

        store.initialize();
        return store;
    }

    public void testAdds() throws Exception{
        ListContainerImpl list=getStoreList("test");
        List data=getDataList(100);
        list.addAll(data);
        assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
        List cached=getCachedList(MAX_CACHE_SIZE);
        for(int i=0;i<cached.size();i++){
            list.add(i,cached.get(i));
        }
        assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
        for(int i=0;i<cached.size();i++){
            assertEquals(cached.get(i),list.getCacheList().get(i));
        }
    }
View Full Code Here

            assertEquals(cached.get(i),list.getCacheList().get(i));
        }
    }

    public void testAddsIntoCacheSpace() throws Exception{
        ListContainerImpl list=getStoreList("test");
        int initialDataSize=50;
        List data=getDataList(initialDataSize);
        list.addAll(data);
        assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
        List cached=getCachedList(MAX_CACHE_SIZE);
        for(int i=MAX_CACHE_SIZE/2;i<cached.size();i++){
            list.add(i,cached.get(i));
        }
        assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
        for(int i=0;i<MAX_CACHE_SIZE/2;i++){
            assertEquals(data.get(i),list.getCacheList().get(i));
        }
        for(int i=MAX_CACHE_SIZE/2;i<MAX_CACHE_SIZE;i++){
            assertEquals(cached.get(i),list.getCacheList().get(i));
        }
    }
View Full Code Here

            assertEquals(cached.get(i),list.getCacheList().get(i));
        }
    }

    public void testRemoves() throws Exception{
        ListContainerImpl list=getStoreList("test");
        int initialDataSize=10;
        List data=getDataList(initialDataSize);
        list.addAll(data);
        assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
        List cached=getCachedList(MAX_CACHE_SIZE);
        list.addAll(cached);
        assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
        for(int i=0;i<cached.size();i++){
            assertNotSame(cached.get(i),list.getCacheList().get(i));
        }
        for(int i=0;i<initialDataSize;i++){
            list.remove(0);
        }
        assertEquals(0,list.getCacheList().size());
        // repopulate the cache
        for(int i=0;i<MAX_CACHE_SIZE;i++){
            list.get(i);
        }
        assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
        for(int i=0;i<cached.size();i++){
            assertEquals(cached.get(i),list.getCacheList().get(i));
        }
    }
View Full Code Here

            assertEquals(cached.get(i),list.getCacheList().get(i));
        }
    }

    public void testCacheSize() throws Exception{
        ListContainerImpl list=getStoreList("test");
        List data=getDataList(100);
        list.addAll(data);
        assertEquals(MAX_CACHE_SIZE,list.getCacheList().size());
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.kaha.impl.container.ListContainerImpl

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.