Home Help Center

Ice::ConnectionLostException in client with callback

rpetersrpeters Member Rich PetersOrganization: braxton technologyProject: cross platfrom JNI replacement ✭✭
Having created a callback interface in a client, and attaching it to a server, I can see the Ice::ConnectionLostException in the client debug trace when the server goes away. I would like to catch this, but I dont see how. Otherwise the client is just dead.

I read the FAQ and other threads regarding Ice::ConnectionLostException, but I dont see any solution there.


thanks
Rich

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    You cannot catch this exception. Perhaps this FAQ is useful to help you. (Note that a callback is just like any other call, except that client and server reverse roles, so if you read this FAQ, for your specific case, you must reverse the meaning of client and server.)
  • rpetersrpeters Member Rich PetersOrganization: braxton technologyProject: cross platfrom JNI replacement ✭✭
    Marc,

    I did look at that FAQ, as I mentioned.

    What then would be the ice solution to allow the client to reattach its callback to the server once it has been restarted?

    thanks
    Rich
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    Rich,

    Please note that this is nothing Ice specific. You cannot rely on a connection closure callback to re-establish a connection back to the server for the reasons outlined in the FAQ to which Marc linked.

    Depending on the structure of your application there are multiple solutions. One possible solution is to make the callback persistent in the server. When the server comes back it starts calling back on the clients which were previously connected. This is how IceStorm works.

    If persistence is not suitable in your case you could establish a session with the server in question. Once the session goes away (which you can reliably detect) then you start to re-establish the session. If you need an example of how to do sessions check demo/Ice/session.
  • rpetersrpeters Member Rich PetersOrganization: braxton technologyProject: cross platfrom JNI replacement ✭✭
    Matthew,

    I will look at sessions. It seems pretty heavy for the task at the moment.

    thanks
    Rich
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    Compared to adding persistence in the server, using a session based architecture is likely much simpler. It also makes it easy to reliably track your clients connectivity, and maintain per-session state.
  • rpetersrpeters Member Rich PetersOrganization: braxton technologyProject: cross platfrom JNI replacement ✭✭
    Thanks,

    Rich
Sign In or Register to comment.