[jboss-cvs] JBossCache/src/org/jboss/cache/pojo/util ...
Ben Wang
bwang at jboss.com
Tue Feb 20 08:06:46 EST 2007
User: bwang
Date: 07/02/20 08:06:46
Modified: src/org/jboss/cache/pojo/util AopUtil.java
Log:
JBCACHE-981 additional internal mapping
Revision Changes Path
1.2 +46 -4 JBossCache/src/org/jboss/cache/pojo/util/AopUtil.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AopUtil.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/util/AopUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- AopUtil.java 13 Jan 2007 15:55:00 -0000 1.1
+++ AopUtil.java 20 Feb 2007 13:06:46 -0000 1.2
@@ -21,6 +21,8 @@
import org.jboss.util.id.GUID;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
/**
* Unitlity methods for put, get and remove Collection classes object.
@@ -141,19 +143,59 @@
// return new Fqn(baseFqn, fqn);
}
+ /**
+ * Internal fqn is now structured as:
+ * a) If no region -- /__JBossInternal__/trueId/__ID__/xxxx
+ * b) If there is region -- /region/__JBossInternal__/xxx
+ */
public static Fqn createInternalFqn(Fqn fqn, Cache cache)
{
+ // Extract the original id as it will be fqn - JBOSS_INTERNAL_ID_SEP
+ // Also the current fqn can be like: /person/__JBossInternal__/test1/_ID_, for region specific ops
+ Fqn trueId = null;
+ if(fqn.hasElement(InternalConstant.JBOSS_INTERNAL_ID_SEP_STRING))
+ {
+ List list = new ArrayList();
+ for(int i =0; i < fqn.size(); i++)
+ {
+ if( fqn.get(i).equals(InternalConstant.JBOSS_INTERNAL_STRING) )
+ {
+ continue;
+ }
+
+ if( fqn.get(i).equals(InternalConstant.JBOSS_INTERNAL_ID_SEP_STRING) )
+ {
+ break;
+ }
+ list.add(fqn.get(i));
+ }
+ trueId = new Fqn(list);
+ } else
+ {
+ trueId = fqn;
+ }
+
boolean createIfAbsent = false;
- Region region = cache.getRegion(fqn, createIfAbsent);
+ Region region = cache.getRegion(trueId, createIfAbsent);
// Use guid that is cluster-wide unique.
GUID guid = new GUID();
- if(region == null)
+
+ if(region == null || region.getFqn().equals(Fqn.ROOT))
{
- return new Fqn(InternalConstant.JBOSS_INTERNAL, Fqn.fromString(guid.toString()));
+ // Move id under JBInternal to promote concurrency
+ Fqn f0 = new Fqn(InternalConstant.JBOSS_INTERNAL, trueId);
+ Fqn f = new Fqn(f0, InternalConstant.JBOSS_INTERNAL_ID_SEP);
+ return new Fqn(f, Fqn.fromString(guid.toString()));
} else
{
// Create it under region first.
- return new Fqn(region.getFqn(), InternalConstant.JBOSS_INTERNAL_STRING, guid.toString());
+ Fqn rf = region.getFqn();
+ // Extract rest of fqn id
+ Fqn childf = trueId.getFqnChild(rf.size(), trueId.size());
+ Fqn f0 = new Fqn(InternalConstant.JBOSS_INTERNAL, childf);
+ Fqn f = new Fqn(f0, InternalConstant.JBOSS_INTERNAL_ID_SEP);
+ Fqn f1 = new Fqn(rf, f);
+ return new Fqn(f1, Fqn.fromString(guid.toString()));
}
}
More information about the jboss-cvs-commits
mailing list