Results 1 to 3 of 3

Thread: deactivate particular object

  1. #1
    kitovyj is offline Registered User
    Name: Alexander Ivanenko
    Organization: Auriga inc
    Project: Video Conferencing - RPC in video transcoding
    Join Date
    Aug 2011
    Posts
    7

    deactivate particular object

    Is it possible to deactivate particalar object in object adapter? I have many objects in single object adaper and want to delete the object safely.

    I expect to be able to write something like:

    adapter->remove(object); // stop object method calls
    object->deactivate(); // wait until all requests completed
    delete object; // now can safely delete the object

    By the way, may be "remove" call waits for the completion of the pending requests?

    Best Regards
    Alexander Ivanenko

  2. #2
    bernard's Avatar
    bernard is online now ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Alexander,

    You just need to remove your object (servant) from the object adapter, and nothing else:

    Code:
      adapter->remove(objectID);
    Remember that your servant is a reference-counted object, and you should never call delete explicitly on it.

    When you "add" a servant to the object adapter, Ice inserts this servant in the Active Servant Map (ASM)
    and increases its refcount. When you remove the servant from the object adapter, Ice removes this servant from the ASM and releases this refcount. And when Ice dispatches a request on a servant it found in the ASM, it increments the refcount of this servant for the duration of the dispatch, to prevent the servant from being destroyed during such dispatch.

    Remove does not wait for requests to complete: it just removes the servant from the ASM.

    I hope this is clearer now.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  3. #3
    kitovyj is offline Registered User
    Name: Alexander Ivanenko
    Organization: Auriga inc
    Project: Video Conferencing - RPC in video transcoding
    Join Date
    Aug 2011
    Posts
    7
    Quote Originally Posted by bernard View Post
    And when Ice dispatches a request on a servant it found in the ASM, it increments the refcount of this servant for the duration of the dispatch, to prevent the servant from being destroyed during such dispatch.
    Thank you very much! This is clear now.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find object in object adapter by its proxy
    By dnnbg in forum Help Center
    Replies: 2
    Last Post: 02-25-2009, 04:09 AM
  2. Replies: 2
    Last Post: 06-23-2007, 07:19 AM
  3. Object Factories and object initialisation
    By Nis Baggesen in forum Help Center
    Replies: 1
    Last Post: 09-30-2004, 07:40 AM
  4. 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
  •