Archived

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

Can a Servant implement both dynamic and static invocations

From the docs it seems that a Servant that want to use Dynamic Invocation needs to extend Ice.Blobject but than, using Java, it will not be able to extends the class generated from Slice.

Comments

  • mes
    mes California
    Hi,

    You are correct, a single servant cannot handle both dynamic and static invocations. If you can determine from the information in Ice.Current whether a request should be handled by a Blobject servant or a regular servant, you can use a servant locator to route a request to the proper servant.

    Hope that helps,
    Mark
  • Thanks, but I am not sure I fully understand how to do that.
    1. How can I determine that from the Ice.Current
    2. Isn't that too late? That is done in the Servant/Skeleton that was dispatched, no?
  • mes
    mes California
    aozarov wrote: »
    1. How can I determine that from the Ice.Current
    Ice.Current contains information such as the name of the operation and the identity of the Ice object. If you can decide based on this information whether the request should be dispatched using a dynamic or static servant, then you can use a servant locator for this purpose.
    2. Isn't that too late? That is done in the Servant/Skeleton that was dispatched, no?
    No, the purpose of a servant locator is to supply a servant for each incoming request. The servant locator is provided with the Ice.Current object that will eventually be passed to the servant returned by the locator.

    Take care,
    Mark
  • Ok, thanks.
    I see now. Assuming you are referring to Ice.LocatorPrx do you have any examples of changing the clients/proxy locator?
    Can it delegate to the default locator (e.g. after renaming the object identity)?
  • mes
    mes California
    Hi,

    Locators and servant locators are two different concepts. You can read about servant locators here.

    Take care,
    Mark
  • Thanks, I was aware of that but thought you were referring to client side interception. Assuming you were actually referring to server side interception by using the ServantLocator I can clearly see how it can work.

    BTW, Any reason not to make any generated Skeleton extends Blobject instead of extending directly ObjectImpl and considering the ice_invoke method (which can throw "not support" exception as default implementation?