Home Help Center

object registrations/deregistration and cleanup

orouletoroulet Member Olivier RouletOrganization: NTNU/SINTEFProject: Holonic manufacturing System
Hi,

We are developping an application (in python and C++) using Ice where we dynamically register servants to icegrid using
self._admin.addObjectWithType(hprx, prx.ice_id())

We have some bugs and we sometimes need to clean the iceregistry database.

I find the servants using :
objects = queryPrx.findAllObjectsByType(htype)

But how do I find all registered Adapters ?... I tried to use findAllObjectsByType using the adapter type but I did not find anything

and does Ice has a generic type so I can find all objects like findAllObjectsByType(*) or findAllObjectsByType(::)

A related question:
It looks like when closing a servant , if another servant has a proxy to it, then self._admin.removeObject(iceid) fails ....
How can I avoid that, apart from asking all clients to destroy they proxies to the dying servant ?

Thank you

Olivier

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    oroulet wrote: »
    Hi,

    We are developping an application (in python and C++) using Ice where we dynamically register servants to icegrid using
    self._admin.addObjectWithType(hprx, prx.ice_id())

    We have some bugs and we sometimes need to clean the iceregistry database.

    I find the servants using :
    objects = queryPrx.findAllObjectsByType(htype)

    But how do I find all registered Adapters ?... I tried to use findAllObjectsByType using the adapter type but I did not find anything

    To find the registered adapters you have to use the IceGrid Admin interface. You can call IceGrid::Admin::getAllAdapterIds to retrieve all of the registered adapter ids.
    and does Ice has a generic type so I can find all objects like findAllObjectsByType(*) or findAllObjectsByType(::)

    Similarly with the admin interfaces you can use IceGrid::Admin::getAllObjectInfos with a regular expression.
    A related question:
    It looks like when closing a servant , if another servant has a proxy to it, then self._admin.removeObject(iceid) fails ....
    How can I avoid that, apart from asking all clients to destroy they proxies to the dying servant ?

    Thank you

    Olivier

    This cannot be the case. Servers are not, and cannot be, aware of which clients have proxies which refer to objects which are hosted in the server. What exactly is failing?
  • orouletoroulet Member Olivier RouletOrganization: NTNU/SINTEFProject: Holonic manufacturing System
    matthew wrote: »

    This cannot be the case. Servers are not, and cannot be, aware of which clients have proxies which refer to objects which are hosted in the server. What exactly is failing?

    Thank you for your very quick answer.
    What we are trying to do is to programmatically de-register from icegrid and sometimes it fails with Ice::ObjectNotExistException and we do not know why.

    Here is the code :
    Ice::ObjectNotExistException

    def _deregisterAgent(self, iceid):
    try:
    self._admin.removeObject(iceid)
    except (Ice.ObjectNotExistException, IceGrid.ObjectNotRegisteredException), why:
    print "Could not de-register agent", "\n", iceid , "\n", why, "\n"

    getting an IceGrid.objectNotregisteredException is fine since it is not database but Ice.ObjectNotExistException is our problem

    self._admin is created when the program starts with

    self._registry = IceGrid.RegistryPrx.uncheckedCast(self._ic.stringToProxy("IceGrid/Registry"))
    self._session = self._registry.createAdminSession(config.AdminUser, config.AdminPasswd)
    self._admin = self._session.getAdmin()

    This mean every process has its own admin session to be able to register
  • orouletoroulet Member Olivier RouletOrganization: NTNU/SINTEFProject: Holonic manufacturing System
    oroulet wrote: »
    This mean every process has its own admin session to be able to register

    every process creates its own session but they all use the same password and user
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    Are you keeping the session alive? If you don't regularly call keepAlive on the session, it will be destroyed and you'll get an ObjectNotExistException when you try and use it. See cpp/src/IceGrid/Client.cpp for an example.
  • orouletoroulet Member Olivier RouletOrganization: NTNU/SINTEFProject: Holonic manufacturing System
    that was it !
    Thank you
Sign In or Register to comment.