Results 1 to 3 of 3

Thread: Servant locators throwing application exceptions

  1. #1
    blair is offline Registered User
    Name: Blair Zajac
    Organization: Sony Pictures Imageworks
    Project: VnP
    Join Date
    Mar 2007
    Posts
    52

    Servant locators throwing application exceptions

    We're developing an versioned asset management system and one of the requirements for the new Ice version from the previous CORBA version is to have an arbitrary long chained stack trace thrown to the client when anything fails. The users of our API will open tickets or email us problems and we want the entire stack trace to see what went wrong.

    So we have something like

    Code:
        struct SpiIceCause {
            string message;
            StringSeq stackTrace;
        };
    
        sequence<SpiIceCause> SpiIceCauseSeq;
    
        exception SpiIceException
        {
            string message;
            StringSeq stackTrace;
            SpiIceCauseSeq causedBy;
        };
    We're also storing millions of objects in the system so we also need servant locators.

    The two don't mix too well. The system allows people to delete assets, so if one client has a proxy to an object and deletes it and another one later tries an operation on it, then the client will get an ObjectNotExistException; I can't throw my own application specific exceptions here. This isn't good enough; I want to know why the object cannot be found, since I have a versioned filesystem and not just a database at the back end, so the asset not being found is more complicated then a simple "the row does not exist."

    So what I've implemented is a deferred or lazy initialization of the servants. The servant locator will construct a servant for any Ice identity name, so ObjectNotExistException is never thrown. Then in all servant methods, I run a initialize_servant() method that takes the Ice identity name, unserializes the constructor arguments from the name it and initializes itself. If for some reason, the object in the backend cannot be found, then I can throw any application specific exception.

    It would be useful if the servant locator mechanism could be extended to allow arbitrary exceptions to be thrown. This would considerably simplify my code.

    In fact, it seems that in Ice, anywhere one can extend Ice to provide implementation code, Ice should allow user exceptions to be thrown.

    Regards,
    Blair

  2. #2
    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,863
    We are currently discussing this internally. Off hand, I don't see a reason why we shouldn't allow user exceptions to be raised from servant locators, but we first need to investigate the implications further.

  3. #3
    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
    I agree that it should be possible to throw user exceptions from locate() and finished(). We'll add this to the next release of Ice.

    Cheers,

    Michi.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Exception throwing question
    By g00fy in forum Help Center
    Replies: 2
    Last Post: 06-28-2006, 07:40 PM
  2. Re-throwing exception in Ice for C#
    By kwaclaw in forum Comments
    Replies: 1
    Last Post: 10-20-2005, 06:47 PM
  3. Throwing exception from another module
    By beardo in forum Help Center
    Replies: 3
    Last Post: 06-01-2005, 12:21 PM
  4. Replies: 8
    Last Post: 05-20-2005, 05:10 PM
  5. question: servant locators
    By raj in forum Help Center
    Replies: 1
    Last Post: 12-28-2003, 01:50 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
  •