Archived

This forum has been archived. Please start a new discussion on GitHub.

Access to ObjectAdapter's Active Servant Map

Hi, I'm trying to implement a sort of Home interface which can be queried to find out which services are currently running inside the application.

It works like this. There are multiple apps each with 1 ObjectAdapter who register with the IceGrid registry. Then a separate GUI can 1) query the registry for the list of AdapterID's and 2) query each home@adapterId for the name of active services.

I'm currently using static information in my own config files but I would like to get this information dynamically.

The ObjectAdapter API only allows lookup of servants by identity and not getting the entire Active Servant Map. Is this done for scalability? Is there a workaround?

I guess an alternative would be to register all my services as well-known objects and then the registry can be queried for them in one step.

thanks a bunch,
alex

Comments

  • benoit
    benoit Rennes, France
    Hi,

    There's no such method because so far it hasn't been needed or requested :). Couldn't you maintain your own map of servants for your active services? Or actually, don't you just need the names?

    Retrieving the list of adapter IDs requires to have access to the IceGrid::Admin interface (through the admin endpoints), this might be a security issue if any client is allowed to access it.

    I think it would be better if you register the "home" objects as well-known objects. You can easily retrieve them with the IceGrid::Query interface findAllObjectsByType(<registered type>) operation and invoke on each object to retrieve the names of the active services of each application.

    Cheers,
    Benoit.
  • bernard
    bernard Jupiter, FL
    Hi Alex,

    If there is anything you don't like with the active servant map, just use your own Servant Locator.

    When implementing your servant locator, you'll see that providing an iterator on all the servants is not trivial. To do it correctly, you'll need to lock the map while iterating, or provide a snapshot (copy) of the entire map.

    Cheers,
    Bernard
  • benoit wrote:
    Hi,

    There's no such method because so far it hasn't been needed or requested :). Couldn't you maintain your own map of servants for your active services? Or actually, don't you just need the names?

    I could maintain my own I suppose, but it'd be easier if didn't have to :)

    And, yes, all I need is a list of servant identities. That would be a good function to have I think in the ObjectAdapter interface, if it's not too hard.
    benoit wrote:
    I think it would be better if you register the "home" objects as well-known objects. You can easily retrieve them with the IceGrid::Query interface findAllObjectsByType(<registered type>) operation and invoke on each object to retrieve the names of the active services of each application.

    true, that's an option I haven't thought of. that would eliminate the need for the Admin interface (which we have enabled right now).

    Ok, thanks guys. I can see my options now. If you think it's easy/useful to add something like getAllObjectIdentities() that would be great.

    thanks, alex
  • marc
    marc Florida
    n2503v wrote:
    I could maintain my own I suppose, but it'd be easier if didn't have to :)

    And, yes, all I need is a list of servant identities. That would be a good function to have I think in the ObjectAdapter interface, if it's not too hard.

    It's not hard, but I prefer to keep the interfaces minimal. It's very easy to keep track of the servants you add to the ASM yourself. Just add them to a map maintained by your application.

    In general, we only add convenience functions if such functions are required by the majority of applications. If we would add convenience functions for every possible use case, our APIs would look like a dog's breakfast :)
  • No worries. I understand your point.
  • benoit wrote:
    Retrieving the list of adapter IDs requires to have access to the IceGrid::Admin interface (through the admin endpoints), this might be a security issue if any client is allowed to access it.

    I think it would be better if you register the "home" objects as well-known objects. You can easily retrieve them with the IceGrid::Query interface findAllObjectsByType(<registered type>) operation and invoke on each object to retrieve the names of the active services of each application.

    Hi Benoit,
    I went back to this old thread and wanted to implement what you suggested (registering Home servants as well-known objects) but ... it seems that to register them programmatically with addObject() I'd need access to the same IceGrid/Admin interface. (sec.36.5). Now the clients don't need to access IceGrid/Admin but server do.

    This change may still be worth doing for me but I want to make sure I'm not missing something.

    Thanks, alex m.
  • benoit
    benoit Rennes, France
    Hi Alex,

    Yes, the only way to register a well-known object programatically is through the IceGrid::Admin interface. If your servers have access to this interface, this shouldn't be a problem -- they can register the well-known object on startup for example.

    But do you really need to do it programatically? Don't you deploy your servers with the IceGrid deployment mechanism? In which case, you could simply register them with the <object> XML element.

    Cheers,
    Benoit.
  • benoit wrote:

    But do you really need to do it programatically? Don't you deploy your servers with the IceGrid deployment mechanism? In which case, you could simply register them with the <object> XML element.

    Yes I'm using IceGrid and using the <object> element is really easy. But I'd like to do Home interface uniformly with or without IceGrid. I think I'll give it a go. Finding objects by type is very nice.

    thanks, alex