Home Help Center

Sending Exception To Client from AMI

jessejesse Member Jesse AndersonOrganization: Bright SystemsProject: Data Moving ✭✭
I have a client application that calls a method on the server. Since this operation takes a long time, I spawn a new thread on the server.

During the life of the server's thread there are several Exceptions that can be raised. How should I pass those exceptions back to the client? Should I create a client callback method to pass an Exception or is there a better way?


  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    If the operation spawns a separate thread then I assume that your server is using asynchronous method dispatch (AMD). In this case, you invoke ice_exception on the AMD callback object (from any thread) in order to report an exception to the client.

    If the operation is not using AMD, then you must somehow arrange for the dispatch thread (not the spawned thread) to raise the appropriate exception. However, when a server is spawning worker threads you'll generally find that it's much easier to use AMD instead.

    Hope that helps,
    - Mark
Sign In or Register to comment.