3 Replies Latest reply on Jan 17, 2005 5:03 AM by frito

    Lifecycle of bean references inside Swing client app

    akrzw

      Hi,

      I have simple question. I write a standalone client app with Swing GUI and it uses heavily the methods of session bean via RMI. No wanting to lookup in JNDI for remote interface to bean every time a need a method invocation I will try to store reference to interface in global class and just use it everytime I want to use bean. Is it good idea or not? Is it common pracitce in J2EE apps?

      Could the live reference to bean on the server time out?

      Should I "close" or "dispose" the reference or object created by home interface? I want to use bean. Is it good idea or not? Is it common practice in J2EE apps?

        • 1. Re: Lifecycle of bean references inside Swing client app
          akrzw

          Sorry, there are some typos so I resend correct message:

          Hi,

          I have simple question. I write a standalone client app with Swing GUI and it uses heavily the methods of session bean via RMI. Not wanting to lookup in JNDI for remote interface to bean every time I need a method invocation I will try to store the reference to bean's remote interface in global class and just use it everytime I want to use the bean. Is it good idea or not? Is it common practice in J2EE apps?

          Could the live reference to bean on the server time out?

          Should I "close" or "dispose" the reference or object created by home interface?

          • 2. Re: Lifecycle of bean references inside Swing client app
            frito

            Assumption: you are talking about a stateful session bean.

            You can create the bean with the home interface, an instance of the SFSB is created on the server. The reference (stub) is valid as long as the session bean hasn't timed out. You can even use the handle to store a reference to the bean, which is valid as long as the been hasnt't time out, too.
            When done, you should remove the bean to free the resources.

            • 3. Re: Lifecycle of bean references inside Swing client app
              frito

              btw, the same for statless, but there is no need to remove the bean and there is of course no timeout.