Mercurial > hg > blitz_stable
view src/org/dancres/blitz/entry/Types.java @ 17:46ac1a45718a
Add support for cache partitioning to improve concurrency.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sun, 05 Jul 2009 16:25:18 +0100 |
parents | 3dc0c5604566 |
children |
line wrap: on
line source
package org.dancres.blitz.entry; import java.io.IOException; public class Types { /** Despite appearances, this method doesn't ever need to be called within a DiskTxn because it will only ever be invoked as the indirect result of a write. A write forces loading/creation of the appropriate EntryRepository and <B>then</B> generates an event which can wake up the notify system or blocked match requests. */ public static boolean isSubtype(String aType, String aSubtype) { if (aType.equals(aSubtype)) return true; EntryRepository myRepos = null; try { myRepos = EntryRepositoryFactory.get().find(aType); } catch (IOException anIOE) { // We only ever operate off in-memory entry repos so we never // hit disk which means we won't get a Dbe } if (myRepos != null) { String[] theSubtypes = myRepos.getSubtypes(); for (int i = 0 ; i < theSubtypes.length; i++) { if (theSubtypes[i].equals(aSubtype)) return true; } } return false; } }