[omniORB] corba in COM object, how to shutdown, make thread (again after few failed tests)

Andrey Koubychev email@vtc.ru
Tue, 19 Mar 2002 14:34:48 +0100


Hello Developers,

      I have some questions about "how to shutdown all corba activity
      and free all resources". As I see, there are few programmers in
      maillist who use corba from COM objects.
      I'm familiar with COM and CORBA , but have problems with putting
      all togather.
          My COM object has Init() function with does ORB_init
       and spawn a thread and pass orb as param like:
       // for simplicity , I dont create any POAs and other stuff

      ListeningThread = new omni_thread(startlisten_proc,&orb);
      // Is it correct way ?
      ListeningThread->start();

      In thread :

      CORBA::ORB_ptr  orb = pOrb ;
      orb->run();

      Shutdown() method of COM object has the following :

      orb->shutdown(0);
      void * result;
      ListeningThread->join (&result);

      The problem starts when I try to do: Init(), Shutdown(), Init(),Shutdown()
      the second Shutdown() throws an exception on orb->shutdown(0);
      So if someone created and destroyed my obj twice, I would get
      some problems.
      One of the possible solution at my side is to use ClassFactory for COM
      objects. But this adds more complexity :) If it possible to
      avoid, I will be very happy :)
      
      
-- 
Best regards,
 Andrey                          mailto:email@vtc.ru