activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r409303 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl: IndexRootContainer.java KahaStore.java
Date Thu, 25 May 2006 04:58:35 GMT
Author: chirino
Date: Wed May 24 21:58:35 2006
New Revision: 409303

URL: http://svn.apache.org/viewvc?rev=409303&view=rev
Log:
- do layz intialization of the containers.

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java?rev=409303&r1=409302&r2=409303&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexRootContainer.java
Wed May 24 21:58:35 2006
@@ -112,7 +112,7 @@
         if (index != null){
             return indexManager.getIndex(index.getValueOffset());
         }
-        throw new IOException("Cannot find root for key " + key);
+        return null;
     }
 
     

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java?rev=409303&r1=409302&r2=409303&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/KahaStore.java
Wed May 24 21:58:35 2006
@@ -65,7 +65,6 @@
         if(!closed){
             closed=true;
             if(initialized){
-//                indexManager.close();
                 
                 for (Iterator iter = indexManagers.values().iterator(); iter.hasNext();)
{
                     IndexManager im = (IndexManager) iter.next();
@@ -85,8 +84,7 @@
 
     public synchronized void force() throws IOException{
         if(initialized){
-//            indexManager.force();
-            
+
             for (Iterator iter = indexManagers.values().iterator(); iter.hasNext();) {
                 IndexManager im = (IndexManager) iter.next();
                 im.force();
@@ -116,7 +114,7 @@
     public synchronized boolean delete() throws IOException{
         initialize();
         clear();
-        boolean result=true; //indexManager.delete();
+        boolean result=true;
         
         for (Iterator iter = indexManagers.values().iterator(); iter.hasNext();) {
             IndexManager im = (IndexManager) iter.next();
@@ -146,16 +144,24 @@
     public synchronized MapContainer getMapContainer(Object id, String dataContainerName)
throws IOException{
         initialize();
        
-        MapContainer result=(MapContainer) maps.get(id);
+        MapContainerImpl result=(MapContainerImpl) maps.get(id);
         if(result==null){
+            
             DataManager dm = getDataManager(dataContainerName);
             IndexManager im = getIndexManager(DEFAULT_INDEX_CONTAINER_NAME);
+            
             ContainerId containerId = new ContainerId();
             containerId.setKey(id);
             containerId.setDataContainerPrefix(dataContainerName);
-            IndexItem root=mapsContainer.addRoot(containerId);
+
+            IndexItem root=mapsContainer.getRoot(containerId);
+            if( root == null ) {
+                root=mapsContainer.addRoot(containerId);
+            }
             result=new MapContainerImpl(containerId,root,im,dm);
+            result.expressDataInterest();
             maps.put(containerId.getKey(),result);
+            
         }
         return result;
     }
@@ -186,15 +192,19 @@
     public synchronized ListContainer getListContainer(Object id, String dataContainerName)
throws IOException{
         initialize();
        
-        ListContainer result=(ListContainer) lists.get(id);
+        ListContainerImpl result=(ListContainerImpl) lists.get(id);
         if(result==null){
             DataManager dm = getDataManager(dataContainerName);
             IndexManager im = getIndexManager(DEFAULT_INDEX_CONTAINER_NAME);
             ContainerId containerId = new ContainerId();
             containerId.setKey(id);
             containerId.setDataContainerPrefix(dataContainerName);
-            IndexItem root=listsContainer.addRoot(containerId);
+            IndexItem root=listsContainer.getRoot(containerId);
+            if( root == null ) {
+                root=listsContainer.addRoot(containerId);
+            }
             result=new ListContainerImpl(containerId,root,im,dm);
+            result.expressDataInterest();
             lists.put(containerId.getKey(),result);
         }
         return result;
@@ -245,23 +255,7 @@
             }
             mapsContainer=new IndexRootContainer(mapRoot,rootIndex,rootData);
             listsContainer=new IndexRootContainer(listRoot,rootIndex,rootData);
-            rootData.consolidateDataFiles();
-            for(Iterator i=mapsContainer.getKeys().iterator();i.hasNext();){
-                ContainerId key=(ContainerId) i.next();
-                DataManager dm = getDataManager(key.getDataContainerPrefix());
-                IndexItem root=mapsContainer.getRoot(key);
-                BaseContainerImpl container=new MapContainerImpl(key,root,rootIndex,dm);
-                container.expressDataInterest();
-                maps.put(key.getKey(),container);
-            }
-            for(Iterator i=listsContainer.getKeys().iterator();i.hasNext();){
-                ContainerId key=(ContainerId) i.next();
-                DataManager dm = getDataManager(key.getDataContainerPrefix());
-                IndexItem root=listsContainer.getRoot(key);
-                BaseContainerImpl container=new ListContainerImpl(key,root,rootIndex,dm);
-                container.expressDataInterest();
-                lists.put(key.getKey(),container);
-            }
+
             for (Iterator i = dataManagers.values().iterator(); i.hasNext();){
                 DataManager dm = (DataManager) i.next();
                 dm.consolidateDataFiles();



Mime
View raw message