Results 1 to 9 of 9

Thread: ServantLocator and dispatching thread

  1. #1
    ganzuoni is offline Registered User
    Name: Guido Anzuoni
    Organization: Individual
    Project: No specific project
    Join Date
    Jun 2003
    Location
    Italy
    Posts
    49

    ServantLocator and dispatching thread

    Is there any guarantee that the thread that calls locate on a
    ServantLocator is the same that invokes the operation on the target
    servant and then finished on the ServantLocator again ?

    Regards,
    Guido.

  2. #2
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055

    Re: ServantLocator and dispatching thread

    Originally posted by ganzuoni
    Is there any guarantee that the thread that calls locate on a
    ServantLocator is the same that invokes the operation on the target
    servant and then finished on the ServantLocator again ?
    Yes, that is guaranteed. You can, for example, safely acquire a lock in locate() and release it again in finished().

    Cheers,

    Michi.

  3. #3
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860

    Re: Re: ServantLocator and dispatching thread

    Originally posted by michi
    Yes, that is guaranteed. You can, for example, safely acquire a lock in locate() and release it again in finished().

    Cheers,

    Michi.
    Except if you use AMD: Then the thread that finishes the request will also call finished().

  4. #4
    ganzuoni is offline Registered User
    Name: Guido Anzuoni
    Organization: Individual
    Project: No specific project
    Join Date
    Jun 2003
    Location
    Italy
    Posts
    49

    Re: Re: Re: ServantLocator and dispatching thread

    Originally posted by marc
    Except if you use AMD: Then the thread that finishes the request will also call finished().
    In fact ! That's was my doubt.
    This means that if I need something identifying the "interaction" with
    a Servant (locate, invoke, finish) I must rely on the cookie ?
    If I understand well, there is also the chance for the thread that
    dispatched a request to manage another one before the previous
    gets completed, in the AMD scenario.

    Well, the origin of all it's always the problem of managing
    explicit Current vs ThreadLocalStorage approach.

    A hypotetical TransactionCurrent object should be designed around
    an InteractionLocalStorage concept rather than a ThreadLocal one.
    This kind of local storage can be setup on locate() and cleared on
    finished(), but works only with a ServantLocator.


    Regards,
    Guido.

  5. #5
    ganzuoni is offline Registered User
    Name: Guido Anzuoni
    Organization: Individual
    Project: No specific project
    Join Date
    Jun 2003
    Location
    Italy
    Posts
    49

    Re: Re: Re: ServantLocator and dispatching thread

    Originally posted by marc
    Except if you use AMD: Then the thread that finishes the request will also call finished().
    Hi Marc,
    I have read chapter 15.6.3 and I am a bit confused.
    Can you clarify which threads are distinct in the following
    sequence of calls for an incoming request for both synch and
    async method dispatch:

    1. ServantLocator.locate
    2. xxx.operation
    3. ServantLocator.finish

    Reading the doc I am not sure if the thread that executes 1. and 2.
    is always the same, regardless the dispatch style, or not.

    Regards,
    Guido

  6. #6
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860

    Re: Re: Re: Re: ServantLocator and dispatching thread

    Originally posted by ganzuoni
    Hi Marc,
    I have read chapter 15.6.3 and I am a bit confused.
    Can you clarify which threads are distinct in the following
    sequence of calls for an incoming request for both synch and
    async method dispatch:

    1. ServantLocator.locate
    2. xxx.operation
    3. ServantLocator.finish

    Reading the doc I am not sure if the thread that executes 1. and 2.
    is always the same, regardless the dispatch style, or not.

    Regards,
    Guido
    For regular synchronous dispatch (non-AMD), all of the above is done by the same thread (the dispatcher thread).

    For AMD, (1) and (2) are done by the dispatcher thread, and (3) is done by the thread that finishes the AMD requests (i.e. calls back on the provided AMD callback object).

    Cheers,
    Marc

  7. #7
    ganzuoni is offline Registered User
    Name: Guido Anzuoni
    Organization: Individual
    Project: No specific project
    Join Date
    Jun 2003
    Location
    Italy
    Posts
    49

    Re: Re: Re: Re: Re: ServantLocator and dispatching thread

    Originally posted by marc
    For regular synchronous dispatch (non-AMD), all of the above is done by the same thread (the dispatcher thread).

    For AMD, (1) and (2) are done by the dispatcher thread, and (3) is done by the thread that finishes the AMD requests (i.e. calls back on the provided AMD callback object).

    Cheers,
    Marc
    You mean that in AMD scenario the dispatcher thread invokes
    ServantLocator.locate
    and
    xx.<operation>_async

    and another thread is activated by the invocation of
    response.ice_response(..) (or exception as well) issued from within
    xx.<operation>_async method body ??

    Regards,
    Guido.

  8. #8
    ganzuoni is offline Registered User
    Name: Guido Anzuoni
    Organization: Individual
    Project: No specific project
    Join Date
    Jun 2003
    Location
    Italy
    Posts
    49
    Oops, please forgive and forget.
    Everything is clear on page 428.

    Really great doc upgrade !!

    Regards,
    Guido.

  9. #9
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860

    Re: Re: Re: Re: Re: Re: ServantLocator and dispatching thread

    Originally posted by ganzuoni
    You mean that in AMD scenario the dispatcher thread invokes
    ServantLocator.locate
    and
    xx.<operation>_async

    and another thread is activated by the invocation of
    response.ice_response(..) (or exception as well) issued from within
    xx.<operation>_async method body ??

    Regards,
    Guido.
    No, in the AMD scenario, the dispatcher thread invokes locate() and the operation. Whichever thread calls ice_response() on the callback object will also invoke finished(). No thread is activated for that, the application has to provide the thread that calls back on the AMD callback object.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 11-03-2010, 01:27 PM
  2. Dispatching legacy C++ messages via Ice
    By jharriot in forum Help Center
    Replies: 3
    Last Post: 02-03-2010, 10:02 AM
  3. Replies: 1
    Last Post: 02-25-2009, 11:18 AM
  4. ServantLocator implementation
    By DeepDiver in forum Help Center
    Replies: 10
    Last Post: 06-16-2005, 09:50 AM
  5. ServantLocator::deactivate signature
    By andreynech in forum Bug Reports
    Replies: 1
    Last Post: 05-23-2004, 05:08 PM

Posting Permissions

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