2 Replies Latest reply on Apr 14, 2005 1:56 PM by Thorsten Kunz

    corba tcp connection remains after destoying the orb and und

    Thorsten Kunz Novice

      Hi all,
      I have written a ejb3 service that connects to a remote corba server and other EJBs use it to communnicate via XML with the remote server(this part is working nicely). I don't know if this is the way a ORB/CORBA setup is supposed to be done. So if you have any suggestions please let me know how to do it right. Don't want to paste the whole code but only the parts that I think do matter:

      First I create the ORB/CORBA stuff in the EJBs create() method

      System.out.println("Setting Properties");
      _props = new java.util.Properties();
      _props.put ("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
      _props.put ("org.omg.CORBA.ORBInitialHost", "some.host.com");
      _props.put ("org.omg.CORBA.ORBInitialPort", "123456");
      _props.put ("org.omg.CORBA.ORBClass",
      _props.put ("org.omg.CORBA.ORBSingletonClass",
      System.out.println("init orb");
      _orb = org.omg.CORBA.ORB.init((String[])null, _props);
      _nameService = _orb.resolve_initial_references ("NameService");
      _ncRef = NamingContextHelper.narrow(_nameService);
      NameComponent nc = new NameComponent ("OSSServer", "");
      NameComponent path[] = {nc};
      _server = ServerHelper.narrow(_ncRef.resolve (path));

      And this in the EJBs destroy() method
      _server = null;
      _ncRef = null;
      _nameService = null;
      _orb = null;

      After I deployed the EJB everything works fine and I can communicate with the corba server as I want to. I see 2 tcp network connections to the other corba server:
      tcp 0 0 some.host.com:123456 ESTABLISHED
      tcp 0 0 some.host.com:123456 ESTABLISHED

      The thing that I don't understand is that when I undeploy the EJB and the destroy() method is called I still see the two network connections even when the EJB and its ORB and everything is long gone...
      And when I redeploy the EJB I see 4 tcp connections. Might be a very stupid thing but I am very new to the whole jee/corba thing. So can sombedy point me into the right direction or to some documentation about how to do it right?

      Many thanks!