Sorry, there are some typos so I resend correct message:
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?
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.
btw, the same for statless, but there is no need to remove the bean and there is of course no timeout.