1 // This may look like C, but it's really -*- C++ -*-
3 //=============================================================================
7 * @author Tim Bradley <bradley_t@ociweb.com>
9 //=============================================================================
13 namespace { enum { MAX_ORB_TASK_WORKER_THREADS
= 20 }; }
16 OrbTask::OrbTask(CORBA::ORB_ptr orb
, unsigned num_threads
)
17 : orb_ (CORBA::ORB::_duplicate(orb
)),
18 num_threads_(num_threads
)
31 if (this->num_threads_
< 1)
33 ACE_ERROR_RETURN((LM_ERROR
,
34 "(%P|%t) OrbTask failed to open. "
35 "num_threads_ (%d) is less-than 1.\n",
40 if (this->num_threads_
> MAX_ORB_TASK_WORKER_THREADS
)
42 ACE_ERROR_RETURN((LM_ERROR
,
43 "(%P|%t) OrbTask failed to open. "
44 "num_threads_ (%d) is too large. Max is %d.\n",
45 this->num_threads_
, MAX_ORB_TASK_WORKER_THREADS
),
49 if (CORBA::is_nil(this->orb_
.in()))
51 ACE_ERROR_RETURN((LM_ERROR
,
52 "(%P|%t) OrbTask failed to open. "
53 "ORB object reference is nil.\n"),
57 if (this->activate(THR_NEW_LWP
| THR_JOINABLE
, this->num_threads_
) != 0)
59 // Assumes that when activate returns non-zero return code that
60 // no threads were activated.
61 ACE_ERROR_RETURN((LM_ERROR
,
62 "(%P|%t) OrbTask failed to activate "
63 "(%d) worker threads.\n",
82 "(%P|%t) Exception raised by ORB::run() method. "
83 "OrbTask is stopping.\n"));
91 OrbTask::close(u_long
)