Package org.apache.activemq.kaha.impl.data

Examples of org.apache.activemq.kaha.impl.data.DataManager


        }
    }

    protected ListContainerImpl getStoreList(Object id) throws Exception{
        String containerName="test";
        DataManager dm=store.getDataManager(containerName);
        IndexManager im=store.getIndexManager(dm,containerName);
        ContainerId containerId=new ContainerId();
        containerId.setKey(id);
        containerId.setDataContainerName(containerName);
        IndexItem root=store.getListsContainer().addRoot(im,containerId);
View Full Code Here


                    IndexManager im=(IndexManager)iter.next();
                    im.close();
                    iter.remove();
                }
                for(Iterator iter=dataManagers.values().iterator();iter.hasNext();){
                    DataManager dm=(DataManager)iter.next();
                    dm.close();
                    iter.remove();
                }
            }
        }
    }
View Full Code Here

            for(Iterator iter=indexManagers.values().iterator();iter.hasNext();){
                IndexManager im=(IndexManager)iter.next();
                im.force();
            }
            for(Iterator iter=dataManagers.values().iterator();iter.hasNext();){
                DataManager dm=(DataManager)iter.next();
                dm.force();
            }
        }
    }
View Full Code Here

                IndexManager im=(IndexManager)iter.next();
                result&=im.delete();
                iter.remove();
            }
            for(Iterator iter=dataManagers.values().iterator();iter.hasNext();){
                DataManager dm=(DataManager)iter.next();
                result&=dm.delete();
                iter.remove();
            }
        }
        if(directory!=null&&directory.isDirectory()){
            File[] files=directory.listFiles();
View Full Code Here

        ContainerId containerId=new ContainerId();
        containerId.setKey(id);
        containerId.setDataContainerName(containerName);
        MapContainerImpl result=(MapContainerImpl)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);
            }
View Full Code Here

        ContainerId containerId=new ContainerId();
        containerId.setKey(id);
        containerId.setDataContainerName(containerName);
        ListContainerImpl result=(ListContainerImpl)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);
View Full Code Here

    public IndexRootContainer getMapsContainer(){
        return this.mapsContainer;
    }

    public DataManager getDataManager(String name) throws IOException{
        DataManager dm=(DataManager)dataManagers.get(name);
        if(dm==null){
            dm=new DataManager(directory,name);
            dm.setMaxFileLength(maxDataFileLength);
            recover(dm);
            dataManagers.put(name,dm);
        }
        return dm;
    }
View Full Code Here

        if(closed)
            throw new IOException("Store has been closed.");
        if(!initialized){
            initialized=true;
            log.info("Kaha Store using data directory "+directory);
            DataManager defaultDM=getDataManager(DEFAULT_CONTAINER_NAME);
            rootIndexManager=getIndexManager(defaultDM,DEFAULT_CONTAINER_NAME);
            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);
            }
            lock();
            mapsContainer=new IndexRootContainer(mapRoot,rootIndexManager,defaultDM);
            listsContainer=new IndexRootContainer(listRoot,rootIndexManager,defaultDM);
            /**
             * Add interest in data files - then consolidate them
             */
            generateInterestInMapDataFiles();
            generateInterestInListDataFiles();
            for(Iterator i=dataManagers.values().iterator();i.hasNext();){
                DataManager dm=(DataManager)i.next();
                dm.consolidateDataFiles();
            }
        }
    }
View Full Code Here

     * @throws IOException
     */
    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

     * @throws IOException
     */
    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

TOP

Related Classes of org.apache.activemq.kaha.impl.data.DataManager

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.