2 Replies Latest reply on Oct 14, 2008 6:46 AM by Andrew Rubinger

    Non-deterministic Default JNDI Name

    Andrew Rubinger Master

      Assume:

      @Stateless
      @Remote(MultipleRemoteBindingsTest.class)
      @RemoteBindings(
      {@RemoteBinding(jndiBinding = MultipleRemoteBindingsTest.JNDI_BINDING_1),
       @RemoteBinding(jndiBinding = MultipleRemoteBindingsTest.JNDI_BINDING_2)})
      public class MultipleRemoteBindingsTestBean{}


      The JNDI Name for this bean is non-deterministic, as there's nothing to signal a true default.

      JBossSessionBeanMetaData smd = ...; // This is decorated
      String jndiName = smd.getJndiName();


      At the moment it's JBossSessionPolicyDecorator that chooses the first populated @RemoteBinding.jndiBinding to be default:

      @Override
       public String getMappedName()
       {
       // Obtain remote bindings
       List<RemoteBindingMetaData> bindings = this.delegate.getRemoteBindings();
      
       // If defined, use the first remote binding as a JNDI default
       if (bindings != null && bindings.size() > 0)
       {
       String jndiName = bindings.get(0).getJndiName();
       if (jndiName != null && jndiName.length() > 0)
       {
       return jndiName;
       }
       }
      
       ...}


      S,
      ALR



        • 1. Re: Non-deterministic Default JNDI Name
          jaikiran pai Master

           

          "ALRubinger" wrote:

          The JNDI Name for this bean is non-deterministic, as there's nothing to signal a true default.


          Any specific reason why we need to know the "default" jndiname? Aren't we going to treat all jndi names equally?

          • 2. Re: Non-deterministic Default JNDI Name
            Andrew Rubinger Master

             

            "jaikiran" wrote:
            Any specific reason why we need to know the "default" jndiname?


            Turns out: I don't think so. I ran into this while going through out @RemoteBinding handling to ensure all the bindings were made, and thought this might turn into a hitch of some type.

            "jaikiran" wrote:
            Aren't we going to treat all jndi names equally?


            Not all. :)

            That example makes for two bindings for the "Default Remote Business Interface using the default interceptor stack and remoting to the default Connector". So it turns out we can pick either for the "Default JNDI Name".

            But some explicit @RemoteBindings will have different properties.

            Further, there's the interface-specific bindings which may be invoked upon to get SessionContext.getInvokedBusinessInterface(). The intention is not to look these up directly, but they're the injection targets for the ENC of each component.

            S,
            ALR