0 Replies Latest reply on Feb 9, 2006 2:51 PM by Martin Hejl

    Monitoring long running call

    Martin Hejl Newbie

      Hi everybody,
      I'm relatively new to JBoss and J2EE in general, so maybe I'm missing something obvious. Here's my problem:
      I have a function in a Stateful Session Bean that can take a very long time to complete (anywhere between a few seconds up to 30 minutes or more). To keep the users happy, I would like to be able to monitor the progress of that call. Before the call, I know the number of "steps" that need to be accomplished before the function will return, but I have no way of knowing how long each step will take.
      Is there a "standard" way of getting progress information in the above situation? I've come up with two approaches, but both have drawbacks:
      - register a JMS receiver on the client, that gets progress info. That would be the cleanest solution in my mind, but since one of the requirements (that I have no influence on) is that the product uses encrypted communication only, and that the number of ports used for communication between client and server is kept to a minimum, I'm not sure I can get by with using JMS for the server to contact the client (I'm actually not even sure it can be done at all - as I said, I'm new to all this, and I've only seen references to that possibility in the docs)
      - Set up some sort of "queue" (for example, a list that will hold "ProgressInfo" objects) as a static variable of my stateful session bean (obviously, allowing for several clients to be served at the same time) and poll that variable from the client (using another bean). I'm rather uneasy about that approach, since it sounds like a race condition just waiting to happen.

      Can anybody give me a hint on how to proceed? I'd even be happy with "don't worry, JBoss takes care of concurrent access to static variables" - I just didn't find any hard info if that is indeed the case.