db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r474619 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
Date Tue, 14 Nov 2006 01:17:15 GMT
Author: djd
Date: Mon Nov 13 17:17:14 2006
New Revision: 474619

URL: http://svn.apache.org/viewvc?view=rev&rev=474619
Log:
Simplify the interaction between the monitor and the StorageFactory when the
monitor is obtaining a list of services to boot. Cleaner code avoids creating
a new StorageFactory implementation for each file and handles non-directories cleaner.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java?view=diff&rev=474619&r1=474618&r2=474619
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/StorageFactoryService.java
Mon Nov 13 17:17:14 2006
@@ -31,7 +31,6 @@
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.store.raw.data.DataFactory;
 
 import org.apache.derby.io.StorageFile;
 import org.apache.derby.io.StorageFactory;
@@ -881,19 +880,25 @@
                 {
                     try
                     {
-                        StorageFactory storageFactory = privGetStorageFactoryInstance( true,
contents[index], null, null);
-                        try
-                        {
-                            StorageFile properties = storageFactory.newStorageFile( PersistentService.PROPERTIES_NAME);
-                            if (!properties.exists())
-                                continue;
-                            // convert to a canonical name while we are here.
-                            contents[index] = storageFactory.getCanonicalName();
-                            validIndex = true;
+                        String dirname = contents[index];
+                        StorageFile dir = rootStorageFactory.newStorageFile(dirname);
+                        if (!dir.isDirectory())
+                            continue;
+                        
+                        // Look to see if service.properties is in this
+                        // directory.
+                        StorageFile properties =
+                            rootStorageFactory.newStorageFile(dir,
+                                    PersistentService.PROPERTIES_NAME);
+                        
+                        if (!properties.exists())
+                            continue;
+                        
+                        // convert to a canonical name while we are here.
+                        contents[index] = dir.getCanonicalPath();
+                        validIndex = true;
 
-                            return this;
-                        }
-                        finally { storageFactory.shutdown(); }
+                        return this;
                     }
                     catch (Exception se) { continue; }
                 }



Mime
View raw message