diff options
| author | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-04-07 11:48:50 +0000 |
|---|---|---|
| committer | mcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-04-07 11:48:50 +0000 |
| commit | 4e0fbcbede63c844fcb99dc98eee3446dba7d1df (patch) | |
| tree | 85aab228c3ecabd30f1cec1f04730de4fee1217f /TAO/tests/MT_NoUpcall_Client_Leader/chatter.cpp | |
| parent | 57a3abab77bf7e53eb868b04cc3159a78357f86e (diff) | |
| download | ATCD-4e0fbcbede63c844fcb99dc98eee3446dba7d1df.tar.gz | |
Thu Apr 7 11:40:00 UTC 2011 Martin Corino <mcorino@remedy.nl>
Merged changes from Remedy work branch.
Diffstat (limited to 'TAO/tests/MT_NoUpcall_Client_Leader/chatter.cpp')
| -rw-r--r-- | TAO/tests/MT_NoUpcall_Client_Leader/chatter.cpp | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/TAO/tests/MT_NoUpcall_Client_Leader/chatter.cpp b/TAO/tests/MT_NoUpcall_Client_Leader/chatter.cpp new file mode 100644 index 00000000000..7ff558f9d9a --- /dev/null +++ b/TAO/tests/MT_NoUpcall_Client_Leader/chatter.cpp @@ -0,0 +1,93 @@ +// $Id$ + +#include "SharedIntf_i.h" +#include "worker.h" +#include "chatter.h" + +Chatter::Chatter (CORBA::ORB_ptr orb, const char *ior, ACE_Condition<ACE_Mutex>& cond) + : Worker (orb), + nrequests_ (0), + nreplies_ (0), + ior_ (ior), + cond_ (cond) +{ +} + +long +Chatter::nreplies (void) +{ + return this->nreplies_; +} + +long +Chatter::nrequests (void) +{ + return this->nrequests_; +} + +int +Chatter::svc (void) +{ + long nrq = nrequests (); + try + { + //sleep(1); + + // get server ior from file + CORBA::Object_var rawObject = orb_->string_to_object( ior_.in ()); + + Test_Idl::SharedIntf_var intf_var = + Test_Idl::SharedIntf::_narrow(rawObject.in()); + + if (CORBA::is_nil (intf_var.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Nil reference <%s>\n", ior_.in()), -1); + + // make call on server + ACE_DEBUG((LM_INFO,"(%P|%t) Chatter[%d] started for %s\n", nrq, ior_.in ())); + nrequests_++; + intf_var->ping(); + nreplies_++; + + ACE_DEBUG((LM_INFO,"(%P|%t) Chatter[%d] completed for %s\n", nrq, ior_.in ())); + cond_.signal(); + return 0; + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + ACE_DEBUG((LM_INFO,"(%P|%t) Chatter[%d] %p for %s\n", nrq, "failed", ior_.in ())); + } + return -1; +} + +int +Chatter::farewell () +{ + try + { + ACE_DEBUG((LM_INFO,"(%P|%t) Farewell requested for %s\n", ior_.in ())); + + // get server ior from file + CORBA::Object_var rawObject = orb_->string_to_object( ior_.in ()); + + Test_Idl::SharedIntf_var intf_var = + Test_Idl::SharedIntf::_narrow(rawObject.in()); + + if (CORBA::is_nil (intf_var.in ())) + ACE_ERROR_RETURN ((LM_ERROR, "Nil reference <%s>\n", ior_.in()), -1); + + // make call on server + ACE_DEBUG((LM_INFO,"(%P|%t) farewell START for %s\n", ior_.in ())); + intf_var->farewell(); + + ACE_DEBUG((LM_INFO,"(%P|%t) farewell COMPLETE for %s\n", ior_.in ())); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + ACE_DEBUG((LM_INFO,"(%P|%t) %p for %s\n", "farewell FAILED", ior_.in ())); + } + return 0; +} + + |
