Results 1 to 7 of 7

Thread: Question about Remoting Methods + Threading

  1. #1

    Default 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. #2

    Default

    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...

  3. #3
    Join Date
    Oct 2005
    Posts
    11

    Default

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Sydney, Australia
    Posts
    14

    Default

    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

  5. #5

    Default

    Excellent response...thank you.

  6. #6
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    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 at 01:26 PM.

  7. #7

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •