[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
manik at jboss.org
Mon Jul 30 16:35:23 EDT 2007
User: msurtani
Date: 07/07/30 16:35:23
Modified: src/org/jboss/cache RegionManager.java
Log:
RegionManager enhancements
Revision Changes Path
1.39 +26 -7 JBossCache/src/org/jboss/cache/RegionManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RegionManager.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/RegionManager.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- RegionManager.java 28 Jun 2007 16:53:35 -0000 1.38
+++ RegionManager.java 30 Jul 2007 20:35:23 -0000 1.39
@@ -137,8 +137,18 @@
*/
public Region getRegion(Fqn fqn, Region.Type type, boolean createIfAbsent)
{
+ // make sure we have a default region defined.
+ Region defaultRegion = regionsRegistry.get(Fqn.ROOT);
+ if (defaultRegion == null)
+ {
+ defaultRegion = new RegionImpl(Fqn.ROOT, this);
+ regionsRegistry.put(Fqn.ROOT, defaultRegion);
+ }
+
Fqn fqnToUse = fqn;
if (DEFAULT_REGION.equals(fqnToUse)) fqnToUse = Fqn.ROOT;
+ Region firstFound = null;
+
// first see if a region for this specific Fqn exists
if (regionsRegistry.containsKey(fqnToUse))
{
@@ -152,6 +162,10 @@
{
return r;
}
+ if (type == Region.Type.MARSHALLING)
+ {
+ firstFound = r;
+ }
}
// if not, attempt to create one ...
@@ -195,11 +209,16 @@
{
nextBestThing = r;
}
+ if (type == Region.Type.MARSHALLING && firstFound == null)
+ {
+ firstFound = r;
+ }
}
if (nextFqn.isRoot()) break;
}
- return nextBestThing;
+ if (nextBestThing == null && firstFound == null && type == Region.Type.MARSHALLING) return defaultRegion;
+ return (nextBestThing == null ? firstFound : nextBestThing);
}
/**
More information about the jboss-cvs-commits
mailing list