Archived

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

ice_getConnection - results: connection from connection cached, not actual manually closed

result ice_getConnection mayby not actuall connection.
is it bag or normal?

auto instance_prx = _communicator->propertyToProxy({});
auto connection = instance_prx->ice_getConnection();  // new connection

connection->close(::Ice::ConnectionClose::GracefullyWithWait);

// results: connection from connection cached, manually closed
connection = instance_prx->ice_getConnection(); **// fail results !!**

// workaround
instance_prx = _communicator->stringToProxy(instance_prx->ice_toString());
connection = instance_prx->ice_getConnection(); // new connection
Tagged:

Comments

  • benoit
    benoit Rennes, France

    Hi,

    The second call to ice_getConnection after the connection close should re-establish a new connection and succeed. Isn't this what you are observing? What do you expect?

    Cheers,
    Benoit.

  • I see : ice_getConnection - connection from connection cached.
    Version: ice3.7.1

    connection->close(::Ice::ConnectionClose::GracefullyWithWait);
    
    // results: connection from connection cached, manually closed
    connection = instance_prx->ice_getConnection(); // no new connection. Is it BUG?
    if ()
    { // variant fixed
     instance_prx->ice_fixed(connection)->ice_ping(); // throw Ice::ConnectionManuallyClosedException
    }
    else
    {
    instance_prx->ice_ping(); // create new connection
    }
    
  • benoit
    benoit Rennes, France

    Hi,

    Ok it's not a bug, ice_getConnection returns the cached connection without checking its state. The closed cached connection will only be cleared once you invoke an operation on the proxy. You can disable connection caching if you want the proxy to obtain a new connection the second time.

    Cheers,
    Benoit.