[jboss-cvs] JBossAS SVN: r77127 - projects/jboss-aspects/trunk/remoting/src/main/java/org/jboss/aspects/remoting.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Aug 16 01:42:48 EDT 2008


Author: ron_sigal
Date: 2008-08-16 01:42:47 -0400 (Sat, 16 Aug 2008)
New Revision: 77127

Modified:
   projects/jboss-aspects/trunk/remoting/src/main/java/org/jboss/aspects/remoting/RemotingProxyFactory.java
Log:
JBAS-4456: Made jndiName property optional.

Modified: projects/jboss-aspects/trunk/remoting/src/main/java/org/jboss/aspects/remoting/RemotingProxyFactory.java
===================================================================
--- projects/jboss-aspects/trunk/remoting/src/main/java/org/jboss/aspects/remoting/RemotingProxyFactory.java	2008-08-16 05:10:25 UTC (rev 77126)
+++ projects/jboss-aspects/trunk/remoting/src/main/java/org/jboss/aspects/remoting/RemotingProxyFactory.java	2008-08-16 05:42:47 UTC (rev 77127)
@@ -52,7 +52,7 @@
  *       <code>org.jboss.remoting.transport.Connector</code> running
  *       an <code>org.jboss.aspects.remoting.AOPRemotingInvocationHandler</code>,</li>
  *   <li>a target object, and</li>
- *   <li>a JNDI name,</li>
+ *   <li>a JNDI name (optional),</li>
  * </ul>
  * <p>
  * RemotingProxyFactory will create a proxy that
@@ -64,7 +64,7 @@
  *       by the provided target,</li>
  * </ol>
  * <p>
- * and it will bind the proxy to the provided name in JNDI.
+ * and, if the JNDI name property has been set, it will bind the proxy to the provided name in JNDI.
  * 
  * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
  * @version $Revision: 1.1 $
@@ -336,12 +336,15 @@
       // Create proxy.
       ClassLoader loader = getContextClassLoader();
       proxy = Remoting.createRemoteProxy(dispatchName, loader, interfaces, invokerLocator, verifiedInterceptors, subsystem);
-      log.debug("Created proxy for " + dispatchName);
+      log.debug("Created proxy for target \"" + dispatchName + "\"");
       
       // Bind proxy in JNDI.
-      InitialContext ctx = new InitialContext();
-      Util.bind(ctx, jndiName, proxy);
-      log.debug("Bound proxy for " + dispatchName + " to " + jndiName);
+      if (jndiName != null)
+      {
+         InitialContext ctx = new InitialContext();
+         Util.bind(ctx, jndiName, proxy);
+         log.debug("Bound proxy for target \"" + dispatchName + "\" to \"" + jndiName + "\"");
+      }
    }
 
    /**
@@ -359,9 +362,14 @@
    public void stop() throws Exception
    {
       Dispatcher.singleton.unregisterTarget(dispatchName);
-      InitialContext ctx = new InitialContext();
-      Util.unbind(ctx, jndiName);
-      log.debug("Unbound proxy for " + dispatchName);
+      log.debug("Unregistered proxy target: \"" + dispatchName + "\"");
+      
+      if (jndiName != null)
+      {
+         InitialContext ctx = new InitialContext();
+         Util.unbind(ctx, jndiName);
+         log.debug("Unbound proxy for target \"" + dispatchName + "\" from JNDI: \"" + jndiName + "\"");
+      }
    }   
    
    private void doSanityChecks() throws Exception
@@ -384,9 +392,6 @@
       if (dispatchName == null)
          throw new Exception("Cannot start factory: dispatchName == null");
       
-      if (jndiName == null)
-         throw new Exception("Cannot start factory: jndiName == null");
-      
       if (invokerLocator == null && connector == null)
          throw new Exception("Cannot start factory: locator == null and connector == null");
       




More information about the jboss-cvs-commits mailing list