1 Reply Latest reply on Nov 14, 2008 12:55 AM by ron_sigal

    JBoss Remoting on JBossAS4.2 usage

    riizzz

      Hi, newbie here.
      I am currently trying to develop swing application that connect to JBossAS.

      on the server side i have

      ...
      @Remote
      public interface PersonManager {
       Person getAllPerson();
      }
      ...
      


      on client i have
      ...
       Context context;
       Properties prop = new Properties();
       prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       prop.put(Context.PROVIDER_URL,"jnp://localhost:1099");
       context = new InitialContext(prop);
       PersonManager pm = (PersonManager)context.lookup("MyApp/PersonManagerImpl/remote");
       List<Person> l = pm.getAllPerson();
      ...
      


      so far, it works. I am able to retrieve list of person i wanted. Now, assuming i need to retrieve list consist of thousands object, that would take quite a time in high latency and slow bandwidth.

      From my understanding, we can achieve better result by using JBoss remoting. I am not sure if I am correct at this. If it is possible, anyone have direction or sample code? I already read JBoss remoting manual and couple of reference material but still i am totally blank at this.

        • 1. Re: JBoss Remoting on JBossAS4.2 usage
          ron_sigal

          Well, it's probably true that you might get better performance using a pure Remoting solution, but you would need to duplicate some of the services provided by EJB3 and the Application Server, which, depending on which services you need, could be a more or less burdensome undertaking.

          I would suggest, as an alternative, changing your EJB3 interface so that, instead of returning the entire list at once, you just return a piece of it at a time. For example,

          @Remote
          public interface PersonManager {
           Person getPersons(int from, int count);
          }
          


          where getPersons(7, 11) would get persons 7 through 17 (if they exist).

          If you still want to use Remoting directly, then you would have to write an instance of org.jboss.remoting.ServerInvocationHandler which returns the list of "persons" for you.