1 #include "TestEventConsumer_i.h"
3 #include "ace/Log_Msg.h"
5 TestEventConsumer_i::TestEventConsumer_i (CORBA::ORB_ptr orb
, bool hang
)
6 : orb_ (CORBA::ORB::_duplicate (orb
)),
16 TestEventConsumer_i::activate ()
18 this->orbtask_
.activate ();
22 TestEventConsumer_i::ORB_task::svc ()
24 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("TestEventConsumer_i ORB_task starting\n")));
28 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("TestEventConsumer_i ORB_task exiting\n")));
30 catch (const CORBA::SystemException
&e
)
32 e
._tao_print_exception (
34 "TestEventConsumer_i ORB_task: Caught CORBA::Exception:"));
40 TestEventConsumer_i::push (const CORBA::Any
& data
)
42 // Extract event data from the any.
43 const char *eventData
;
44 if (data
>>= eventData
)
46 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("TestEventConsumer_i::push(): Received ")
47 ACE_TEXT ("event containing %d bytes.\n"),
48 ACE_OS::strlen (eventData
)));
49 if (this->hang_
&& ++this->count_
== 10)
51 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("TestEventConsumer_i::push(): ")
52 ACE_TEXT ("Simulating hung consumer\n")));
54 ACE_GUARD (TAO_SYNCH_MUTEX
, guard
, this->mtx_
);
55 while (!this->shutdown_
)
58 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("TestEventConsumer_i::push Done\n")
65 TestEventConsumer_i::disconnect_push_consumer ()
68 ACE_TEXT ("TestEventConsumer_i::disconnect_push_consumer()\n")));
69 this->orb_
->shutdown ();
70 this->shutdown_
= true;
71 this->cond_
.signal ();