Announcement Announcement Module
Collapse
No announcement yet.
Question about Remoting Methods + Threading Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about Remoting Methods + Threading

    This is probably an easy question...here goes....

    I can see how using an HttpInvoker based solution would allow you to rely on your servlet container to manage the threading aspect of your service... That is to say that multiple "simultaneous" invocations would be handled by multiple threads issued by your servlet container upon recipet of the HttpRequest.

    So...what happens if i exported the same service using RmiServiceExporter? What's the behavior here? Can simultaneous invocations be handled? Will it just block?

    Appreciate the clarification!

    -Andrew

  • #2
    I think i understand what happens here now...

    There will be a remote thread that corresponds to the local thread for each RMI connection...

    However, I'm assuming this is unmanaged...

    Comment


    • #3
      in fact all your beans are :
      • stateless (for a given "configuration")
      • singleton (by default)
      and so can be invoked in parallell (like a good old servlet)

      the state is in your request/response parameters.

      all aspects (transaction, local,...) that are per request are handled using thread local mecanism. The threadlocal variable is initialized by the first caller (controller or filter) and cleared at the last caller return point.

      Stéphan

      Comment


      • #4
        So...what happens if i exported the same service using RmiServiceExporter? What's the behavior here?
        - New thread created for each request.
        This is fine for small to medium scale app but may get expensive as thread creation climbs.

        Can simultaneous invocations be handled?
        Yes.
        Will it just block?
        No

        Craig

        Comment


        • #5
          Excellent response...thank you.

          Comment


          • #6
            With complex and long running background jobs, I normally don't want to execute such a task on an arbitrary client thread.

            That is why I create a component that has his own thread(s). The 'threadaware' component delegates the real work to components that don't know anything about threading.

            This makes it easier to create asynchronous calls, control the number of concurrent threads, control the tasks being processed concurrently. And it also gives you more control on liveness problems and thread priority related problems.
            Last edited by Alarmnummer; Sep 13th, 2006, 01:26 PM.

            Comment


            • #7
              Yeah...I'm looking at doing JMS remoting long term...

              But for now it's RMI, and I wanted to make sure it worked as i thought it did.

              Comment

              Working...
              X