Home Help Center

Sessions without Glacier2

golgobotgolgobot Member Jonathan RossOrganization: Jibo, IncProject: Robotics netoworking
I think the session management is great in Glacier2, but my environment doesn't require a Glacier2 instance, therefor I would rather not add an extra moving part.

Is there a way to implement sessions using just Ice?

Cheers.

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Yes, see the demo in the Ice/session demo directory for one possible implementation.

    Cheers,
    Benoit.
  • golgobotgolgobot Member Jonathan RossOrganization: Jibo, IncProject: Robotics netoworking
    Thanks for the quick reply.

    It seems like that example implementation is based on detecting client heart beats and explicit shutdown or destruction by either the server or the client.

    I guess I'm really looking for a way to detect a ConnectionLostException so I can clean up any proxies or object associated with that connection immediately. I noticed a lot of cleanup occurs in ConnectionI.java, but there is no way of piggy-backing off that cleanup.

    I read an article that explains why Ice does not provide callbacks for closed connections, but I somehow still don't believe that there isn't a way to do that if you really wanted to.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Heart beating is the best reliable way to detect connection loss from the peer with TCP/IP. You can't detect reliably connection loss without sending data to the other peer. This article describes in more details the reasons.

    It's possible the Ice runtime can detect the connection loss sooner. If you need to get this notification as soon as possible, the simplest is to send keep alive messages more often. Another more complex solution is to improve the heart beat mechanism from the demo to always maintain a "long-lived" two-way invocation to the server (or in the other direction depending on which side needs to get the prompt notification of the connection closure). This two-way invocation will raise an exception as soon as the connection loss is detected by the Ice runtime and if the connection can't be re-established upon retry.

    Cheers,
    Benoit.
Sign In or Register to comment.