User: chirino 
  Date: 01/11/11 21:27:35

  Modified:    src/main/org/jboss/mq/il ServerILJMXService.java
  Log:
  More debug statments to help out with clustering work.  Changed the IL JNDI bind 
code so that it does
  a rebind a creates all the required sub contexts
  
  Revision  Changes    Path
  1.8       +27 -4     jbossmq/src/main/org/jboss/mq/il/ServerILJMXService.java
  
  Index: ServerILJMXService.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/ServerILJMXService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ServerILJMXService.java   2001/11/10 21:38:04     1.7
  +++ ServerILJMXService.java   2001/11/12 05:27:35     1.8
  @@ -14,6 +14,8 @@
   import org.jboss.mq.SpyXAConnectionFactory;
   import org.jboss.mq.server.JMSServer;
   import org.jboss.system.ServiceMBeanSupport;
  +import javax.naming.Context;
  +import javax.naming.NamingException;
   
   /**
    *  This abstract class handles life cycle managment of the ServeIL. Should be
  @@ -21,7 +23,7 @@
    *
    * @author     Hiram Chirino ([EMAIL PROTECTED])
    * @author <a href="mailto:[EMAIL PROTECTED]";>David Jencks</a>
  - * @version    $Revision: 1.7 $
  + * @version    $Revision: 1.8 $
    */
   public abstract class ServerILJMXService extends ServiceMBeanSupport implements 
ServerILJMXServiceMBean
   {
  @@ -123,17 +125,38 @@
       */
      public void bindJNDIReferences() throws javax.naming.NamingException
      {
  -
         GenericConnectionFactory gcf = new GenericConnectionFactory(getServerIL(), 
getClientConnectionProperties());
         SpyConnectionFactory scf = new SpyConnectionFactory(gcf);
         SpyXAConnectionFactory sxacf = new SpyXAConnectionFactory(gcf);
   
         // Get an InitialContext
         InitialContext ctx = new InitialContext();
  -      ctx.bind(connectionFactoryJNDIRef, scf);
  -      ctx.bind(xaConnectionFactoryJNDIRef, sxacf);
  +      rebind( ctx, connectionFactoryJNDIRef, scf);
  +      rebind( ctx, xaConnectionFactoryJNDIRef, sxacf);
   
      }
  +   
  +   protected void rebind(Context ctx, String name, Object val)
  +   throws NamingException
  +   {
  +      // Bind val to name in ctx, and make sure that all intermediate contexts exist
  +      javax.naming.Name n = ctx.getNameParser("").parse(name);
  +      while (n.size() > 1)
  +      {
  +         String ctxName = n.get(0);
  +         try
  +         {
  +            ctx = (Context)ctx.lookup(ctxName);
  +         } catch (javax.naming.NameNotFoundException e)
  +         {
  +            ctx = ctx.createSubcontext(ctxName);
  +         }
  +         n = n.getSuffix(1);
  +      }
  +      
  +      ctx.rebind(n.get(0), val);
  +   }
  +      
   
      /**
       *  Unbinds the connection factories for this IL
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to