Mercurial > hg > blitz_condensed
view src/org/dancres/blitz/meta/RegistryFactory.java @ 34:6f68e94c1fb8 default tip
Add CondensedStats monitoring utility, equivalent to vmstat
author | Dominic Cleal <dominic-cleal@cdo2.com> |
---|---|
date | Thu, 05 Aug 2010 11:07:25 +0100 |
parents | 3dc0c5604566 |
children |
line wrap: on
line source
package org.dancres.blitz.meta; import java.io.File; import java.io.IOException; import java.util.Map; import java.util.HashMap; import org.dancres.blitz.disk.Disk; public class RegistryFactory { private static Map theMetas = new HashMap(); /** @param aName the name of the registry you wish to load/create @param anInitializer Registry instances are created under a transaction. Certain uses may require that initialization be done under the same transaction. In these cases, the caller should pass in an Initializer instance containing the appropriate "boot code". If no initialization is required, the caller may pass <code>null</code>. */ public static Registry get(String aName, Initializer anInitializer) throws IOException { synchronized(theMetas) { Registry myData = (Registry) theMetas.get(aName); if (myData == null) { myData = new RegistryImpl(aName, anInitializer); theMetas.put(aName, myData); } return myData; } } public static boolean exists(String aName) { return RegistryImpl.exists(aName); } public static void delete(String aName) throws IOException { synchronized(theMetas) { RegistryImpl myData = (RegistryImpl) theMetas.get(aName); if (myData != null) { theMetas.remove(aName); myData.delete(); } } } }