Skip to main content

How to close the client connection to the Orbix 3 daemon

  • May 17, 2013
  • 0 replies
  • 0 views

Summary How to close the client connection to the Orbix 3 daemon
Article Number 16929
Environment HP-UX 11.0 Orbix 3.x
Question/Problem Description How to close the client connection to the Orbix 3 daemon
How to configure Orbix 3 in order to have the client connection to the Orbix daemon closed automatically?
How to close the Orbix 3 client connection to the daemon programmatically?  
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution

Orbix 3 clients do not automatically close the connection to the Orbix daemon. These connections need to be closed explicitly.

Orbix 3 Java provides the IT_KEEP_ALIVE_FORWARDER_CONNECTION configuration variable which can be set to false in order to close the connection to the Orbix daemon. This variable can be used in the following ways:

  • in the OrbixWeb3.cfg configuration file by setting IT_KEEP_ALIVE_FORWARDER_CONN="false"
  • passed as argument to your Orbix Java programm, e.g
    java test.myclient -OrbixWeb.IT_KEEP_ALIVE_FORWARDER_CONN=false
  • passed as parameter to the JVM, e.g
    java -DOrbixWeb.IT_KEEP_ALIVE_FORWARDER_CONN=false test.myclient
  • passed to ORB.init() in your code, e.g.
    ...
    java.util.Properties p = new java.util.Properties();
    p.put("OrbixWeb.IT_KEEP_ALIVE_FORWARDER_CONN","false");
    orb = ORB.init(args, p);
    ...
  • explicitly close the connection to the Orbix daemon by using the closeConnection() call, e.g.
    ...
    orb = ORB.init(args, null);
    ...
    // after the connection to the server has been established and you do not need the connection to the daemon
    IT_daemon daemonVar = IT_daemonHelper.bind(":IT_daemon","localhost");
    boolean closed = _OrbixWeb.ORB(orb).closeConnection(daemonVar);

Orbix 3 C does not provide a configuration variable, so the only way to close the connection to the daemon is by explicitly closing the connection in the client code.To close the client-daemon connection, you must specifically bind to the daemon first, then close that proxy's channel.

The following is some sample code that will illustrate how to close the client-daemon connection with the CORBA::Orbix.closeChannel() API.

#define WANT_ORBIX_FDS // require for _fd()
#include "grid.hh" // from the grid.idl file
#include "daemon.hh" // from the daemon.idl file

int main () {

  // Client's proxy to the server object
  grid_var myGrid;
  // Client's proxy to the daemon object
  IT_daemon_var daemon;
  try {
    // bind to the daemon first
    daemon = IT_daemon::_bind("","localhost");
    // initial connection between the client
    // and the server is set up
    myGrid = grid::_bind(":grid","localhost");
    // now close the connection from the client to the daemon
    CORBA::Orbix.closeChannel( daemon->_fd() );
  } catch (CORBA::SystemException &se) {
  . . .

}

Workaround
Notes Alternatively, the client connections to the daemon can be closed by using an Orbix smart proxy implementation which explicitly closes the connection through IT_daemon::_closeChannel() after each call to the Orbix daemon.  
Attachment
Created date: 06 September 2011
Last Modified: 13 February 2013
Last Published: 23 June 2012
First Published date: 10 September 2011

#Orbix
#KnowledgeDocs