[jboss-cvs] JBossAS SVN: r108686 - projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 20 10:28:57 EDT 2010
Author: smarlow at redhat.com
Date: 2010-10-20 10:28:56 -0400 (Wed, 20 Oct 2010)
New Revision: 108686
Modified:
projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java
Log:
batch createSubcontext
Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java 2010-10-20 12:08:34 UTC (rev 108685)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/jndi/ispn/DistributedTreeManager.java 2010-10-20 14:28:56 UTC (rev 108686)
@@ -467,67 +467,77 @@
@Override
public Context createSubcontext(Name name) throws NamingException
{
- if (LOG.isTraceEnabled())
+ cache.getCache().startBatch();
+ boolean commit = false;
+ try
{
- LOG.trace("createSubcontext, name="+name);
- }
-
- int size = name.size();
-
- if (size == 0)
- {
- throw new InvalidNameException("Name is empty");
- }
- // does the new context already exist?
- String str = name.toString();
- Fqn fqn = Fqn.fromString(str);
- Fqn ctx = Fqn.fromRelativeFqn(FQN_ROOT, fqn);
- if (this.cache.getRoot().hasChild(ctx))
- {
- throw new NameAlreadyBoundException(str);
- }
-
- // does the prefix context already exist?
- Fqn pctx;
- String newctx = name.get(size - 1);
- if (size > 1) // find subcontext to which the context will be added
- {
- String prefix = name.getPrefix(size - 1).toString();
- Fqn fqn2 = Fqn.fromString(prefix);
- pctx = Fqn.fromRelativeFqn(FQN_ROOT, fqn2);
- boolean exists = this.cache.getRoot().hasChild(pctx);
- if (!exists)
+ if (LOG.isTraceEnabled())
{
- throw new NotContextException(name.getPrefix(size - 1).toString());
+ LOG.trace("createSubcontext, name="+name);
}
- }
- else
- {
- pctx = FQN_ROOT;
- }
- Fqn newf = Fqn.fromRelativeFqn(pctx, Fqn.fromString(newctx));
- try
- {
- this.cache.put(newf, new HashMap<String, Binding>());
- }
- catch (CacheException ce)
- {
- if (LOG.isTraceEnabled())
+ int size = name.size();
+
+ if (size == 0)
{
- LOG.trace(ce.getMessage(), ce);
+ throw new InvalidNameException("Name is empty");
}
- // don't chain CacheException since JBoss Cache may not be on remote client's classpath
- NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
- ne.fillInStackTrace();
- throw ne;
+
+ // does the new context already exist?
+ String str = name.toString();
+ Fqn fqn = Fqn.fromString(str);
+ Fqn ctx = Fqn.fromRelativeFqn(FQN_ROOT, fqn);
+ if (this.cache.getRoot().hasChild(ctx))
+ {
+ throw new NameAlreadyBoundException(str);
+ }
+
+ // does the prefix context already exist?
+ Fqn pctx;
+ String newctx = name.get(size - 1);
+ if (size > 1) // find subcontext to which the context will be added
+ {
+ String prefix = name.getPrefix(size - 1).toString();
+ Fqn fqn2 = Fqn.fromString(prefix);
+ pctx = Fqn.fromRelativeFqn(FQN_ROOT, fqn2);
+ boolean exists = this.cache.getRoot().hasChild(pctx);
+ if (!exists)
+ {
+ throw new NotContextException(name.getPrefix(size - 1).toString());
+ }
+ }
+ else
+ {
+ pctx = FQN_ROOT;
+ }
+
+ Fqn newf = Fqn.fromRelativeFqn(pctx, Fqn.fromString(newctx));
+ try
+ {
+ this.cache.put(newf, new HashMap<String, Binding>());
+ }
+ catch (CacheException ce)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace(ce.getMessage(), ce);
+ }
+ // don't chain CacheException since JBoss Cache may not be on remote client's classpath
+ NamingException ne = new NamingException(ce.getClass().getName() + ": " + ce.getMessage());
+ ne.fillInStackTrace();
+ throw ne;
+ }
+
+ Name fullName = PARSER.parse("");
+ fullName.addAll(name);
+ commit = true;
+ return new NamingContext(null, fullName, this.getHAStub());
}
-
- Name fullName = PARSER.parse("");
- fullName.addAll(name);
-
- return new NamingContext(null, fullName, this.getHAStub());
+ finally
+ {
+ cache.getCache().endBatch(commit);
+ }
}
More information about the jboss-cvs-commits
mailing list