getting time remaining of Stateful EJB

Discussions

EJB design: getting time remaining of Stateful EJB

  1. getting time remaining of Stateful EJB (3 messages)

    Hi,
     Anybody have an idea how do i know whether my cached ejb handle is good? I mean how do i chk my stateful ejb is NOT timed out.

    Thanks
    Bhupesh
  2. The standard way to deal with this is to assume that the bean is there, and be prepared to handle the NoSuchObjectException if it isn't, i.e:

    "An EJB client can determine if an EJB object is valid by placing all method invocations that use the reference inside of a try/catch block that specifically catches the java.rmi.NoSuchObjectException, in addition to any other exceptions that the method needs to handle. The EJB client can then invoke the code to handle this exception"..."The code to create a new EJB object when the old one becomes invalid is the same code used to create the original EJB object" (from IBM WebSphere InfoCenter)
  3. I got your point. Thanks!!! But, I was just wondering... Is that the only way we can handle this situation?
    I mean, I was thinking in the direction where Websphere container could provide me time remaining through some methods coz websphere always has this time out set in its descriptor files.
    Thanks for the reply ... I really appreciate

    Bhupesh
  4. The container has to keep its little secrets I'm afraid. Also I don't believe the time remaining can be predicted, because it is up to the container when to passivate/pool/remove *after* the timeout has expired.