Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / examples / CSD_Strategy / ThreadPool / OrbShutdownTask.cpp
blobee579c9e4c1173a9e15f931e365e361c801ad3d6
1 //=============================================================================
2 /**
3 * @file OrbShutdownTask.cpp
5 * @author Tim Bradley <bradley_t@ociweb.com>
6 */
7 //=============================================================================
9 #include "OrbShutdownTask.h"
10 #include "ace/CORBA_macros.h"
11 #include "ace/OS_NS_unistd.h"
13 OrbShutdownTask::OrbShutdownTask()
17 void
18 OrbShutdownTask::orb(CORBA::ORB_ptr orb)
20 this->orb_ = CORBA::ORB::_duplicate (orb);
23 int
24 OrbShutdownTask::open(void*)
26 if (this->activate(THR_NEW_LWP | THR_JOINABLE, 1) != 0)
28 //FUZZ: disable check_for_lack_ACE_OS
29 // Assumes that when activate returns non-zero return code that
30 // no threads were activated.
31 ACE_ERROR_RETURN((LM_ERROR,
32 "(%P|%t) OrbShutdownTask failed to open().\n"),
33 -1);
34 //FUZZ: enable check_for_lack_ACE_OS
37 return 0;
40 int
41 OrbShutdownTask::svc()
43 ACE_OS::sleep (2);
44 ACE_DEBUG ((LM_DEBUG, "(%P|%t)OrbShutdownTask::svc shutdown orb\n"));
45 try
47 this->orb_->shutdown(0);
49 catch (...)
51 ACE_ERROR((LM_ERROR,
52 "(%P|%t) Exception raised by ORB::shutdown() call "
53 "in OrbShutdownTask::svc().\n"));
56 return 0;
59 int
60 OrbShutdownTask::close(u_long)
62 return 0;