summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-16 05:49:26 +0000
committerkirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-16 05:49:26 +0000
commitc9f4a6bba417efe810790a904589f5177ae62fc7 (patch)
tree51640dbb10bc9a51216b6dafd0f07071fbbe85ec
parentfe2cde42ec8c9d672a210bf962b827d6d94afb00 (diff)
downloadATCD-c9f4a6bba417efe810790a904589f5177ae62fc7.tar.gz
*** empty log message ***
-rw-r--r--TAO/ChangeLog-98c21
-rw-r--r--TAO/examples/Callback_Quoter/Notifier_Input_Handler.cpp64
-rw-r--r--TAO/examples/Callback_Quoter/Notifier_Input_Handler.h5
-rw-r--r--TAO/examples/Callback_Quoter/Notifier_i.cpp51
-rw-r--r--TAO/examples/Callback_Quoter/Notifier_i.h6
5 files changed, 135 insertions, 12 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index de40061b0c1..9fa4d40efb8 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,15 @@
+
+Fri Oct 16 00:45:22 1998 Kirthika Parameswaran <kirthika@cs.wustl.edu>
+
+ * examples/Callback_Quoter/Notifier_Input_Handler.h
+ * examples/Callback_Quoter/Notifier_Input_Handler.cpp
+ added Event mechanism in the Notifier_Input_Handler.
+
+ * examples/Callback_Quoter/Notifier_i.h
+ * examples/Callback_Quoter/Notifier_i.cpp
+ added close call in the shutdown method.
+
+
Thu Oct 15 23:00:35 1998 Jeff Parsons <jp4@cs.wustl.edu>
* tao/DynAny_i.h:
@@ -11,7 +23,7 @@ Thu Oct 15 23:00:35 1998 Jeff Parsons <jp4@cs.wustl.edu>
Thu Oct 15 22:10:48 1998 Sergio Flores <sergio@tango.cs.wustl.edu>
* performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp:
- * performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp:
+ * performance-tests/Cubit/TAO/MT_Cubit/Globals.cpp:
* performance-tests/Cubit/TAO/MT_Cubit/README: Synchronized the
README file with the actual options in the source files. Cleaned
up the wording for the help in the README and source files.
@@ -30,27 +42,28 @@ Thu Oct 15 21:20:56 1998 Nagarajan Surendran <naga@cs.wustl.edu>
Thu Oct 15 20:08:36 1998 Nagarajan Surendran <naga@cs.wustl.edu>
- * performance-tests/Cubit/TAO/MT_Cubit/Task_Client.{h,cpp} :
+ * performance-tests/Cubit/TAO/MT_Cubit/Task_Client.{h,cpp} :
* performance-tests/Cubit/TAO/MT_Cubit/Cubit_Task.{h,cpp}:
* performance-tests/Cubit/TAO/MT_Cubit/Globals.{h,cpp}:
* performance-tests/Cubit/TAO/MT_Cubit/client.cpp:
* performance-tests/Cubit/TAO/MT_Cubit/server.h:
Removed Naming service code from all the files. MT_Cubit
uses only files to share iors of servants to clients. So -s option
- is also removed.
+ is also removed.
* performance-tests/Cubit/TAO/MT_Cubit/Makefile:
Removed liborbsvcs from the LD_LIBS.
* performance-tests/Cubit/TAO/MT_Cubit/MT_Cubit_Test:
Removed -s option for server and client.
-
+
Thu Oct 15 17:29:42 1998 Nanbor Wang <nanbor@cs.wustl.edu>
* orbsvcs/orbsvcs/orbsvcs[_static].dsp: Added EC_UDP_Admin.cpp.
Thanks to Russell L. Carter <rcarter@dnstoo.consys.com> for
reporting this.
+
Thu Oct 15 13:54:23 1998 Kirthika Parameswaran <kirthika@cs.wustl.edu>
* examples/Callback_Quoter/Supplier_i.cpp:
diff --git a/TAO/examples/Callback_Quoter/Notifier_Input_Handler.cpp b/TAO/examples/Callback_Quoter/Notifier_Input_Handler.cpp
index d86bdc3b10d..7b858d3806e 100644
--- a/TAO/examples/Callback_Quoter/Notifier_Input_Handler.cpp
+++ b/TAO/examples/Callback_Quoter/Notifier_Input_Handler.cpp
@@ -35,7 +35,15 @@ Notifier_Input_Handler::Notifier_Input_Handler (void)
Notifier_Input_Handler::~Notifier_Input_Handler (void)
{
- // no-op.
+ // Make sure to cleanup the STDIN handler.
+
+ if (ACE_Event_Handler::remove_stdin_handler
+ (TAO_ORB_Core_instance ()->reactor (),
+ TAO_ORB_Core_instance ()->thr_mgr ()) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "remove_stdin_handler"));
+
}
// The naming service is initialized and the naming context as well as
@@ -136,6 +144,19 @@ Notifier_Input_Handler::init (int argc,
char *argv[],
CORBA::Environment &TAO_TRY_ENV)
{
+
+ // Register our <Input_Handler> to handle STDIN events, which will
+ // trigger the <handle_input> method to process these events.
+
+ if (ACE_Event_Handler::register_stdin_handler
+ (this,
+ TAO_ORB_Core_instance ()->reactor (),
+ TAO_ORB_Core_instance ()->thr_mgr ()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "register_stdin_handler"),
+ -1);
+
// Call the init of <TAO_ORB_Manager> to initialize the ORB and
// create the child poa under the root POA.
@@ -190,9 +211,50 @@ Notifier_Input_Handler::run (CORBA::Environment &TAO_TRY_ENV)
{
// Run the main event loop for the ORB.
+
+ ACE_DEBUG ((LM_DEBUG,
+ " Type \"q\" to quit \n "));
+
if (this->orb_manager_.run (TAO_TRY_ENV) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"Notifier_Input_Handler::run"),
-1);
return 0;
}
+
+int
+Notifier_Input_Handler::handle_input (ACE_HANDLE)
+{
+ char buf[BUFSIZ];
+
+ TAO_TRY
+ {
+ // The string could read contains \n\0 hence using ACE_OS::read
+ // which returns the no of bytes read and hence i can manipulate
+ // and remove the devil from the picture i.e '\n' ! ;)
+
+ ssize_t strlen = ACE_OS::read (ACE_STDIN,
+ buf,
+ sizeof buf);
+ if (buf[strlen -1] == '\n')
+ buf[strlen -1] = '\0';
+
+ ACE_DEBUG ((LM_DEBUG,
+ "%s",
+ buf));
+
+ if (tolower(buf[0]) == 'q')
+ {
+
+ // (this->notifier_i_.consumer_map_).close();
+ this->notifier_i_.shutdown(TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ }
+ }
+ TAO_CATCHANY
+ {
+ TAO_TRY_ENV.print_exception ("Input_Handler::init");
+ return -1;
+ }
+ TAO_ENDTRY;
+}
diff --git a/TAO/examples/Callback_Quoter/Notifier_Input_Handler.h b/TAO/examples/Callback_Quoter/Notifier_Input_Handler.h
index b4cb73ea2a9..9af7ea3e201 100644
--- a/TAO/examples/Callback_Quoter/Notifier_Input_Handler.h
+++ b/TAO/examples/Callback_Quoter/Notifier_Input_Handler.h
@@ -25,7 +25,7 @@
#include "orbsvcs/CosNamingS.h"
#include "orbsvcs/Naming/Naming_Utils.h"
-class Notifier_Input_Handler
+class Notifier_Input_Handler : public ACE_Event_Handler
{
// = TITLE
// The class defines the callback quoter Notifier initialization
@@ -47,6 +47,9 @@ public:
int run (CORBA::Environment &env);
// Run the ORB.
+ virtual int handle_input (ACE_HANDLE);
+ // Handle the user input.
+
private:
int parse_args (void);
// Parses the command line arguments.
diff --git a/TAO/examples/Callback_Quoter/Notifier_i.cpp b/TAO/examples/Callback_Quoter/Notifier_i.cpp
index c62749e5582..5103fbeb3b7 100644
--- a/TAO/examples/Callback_Quoter/Notifier_i.cpp
+++ b/TAO/examples/Callback_Quoter/Notifier_i.cpp
@@ -118,7 +118,7 @@ Notifier_i::unregister_callback (Callback_Quoter::Consumer_ptr consumer,
// will be removed from the set.
// @@ Make sure to check the return value.
- (*iter).int_id_->remove (consumer_to_remove);
+ (*iter).int_id_->remove (consumer_to_remove);
ACE_DEBUG ((LM_DEBUG,
"unregister_callback:consumer removed\n"));
@@ -182,12 +182,45 @@ Notifier_i::market_status (const char *stock_name,
void
Notifier_i::shutdown (CORBA::Environment &)
{
+ if (this->consumer_map_.current_size () > 0)
+ {
+ this->consumer_map_.close ();
- ACE_DEBUG ((LM_DEBUG,
- "The Callback Quoter server is shutting down"));
+ }
+
+ /* for (CONSUMER_MAP::ITERATOR iter = this->consumer_map_.begin ();
+ iter!= this->consumer_map_.end ();
+ iter ++)
+ {
+ (*iter).int_id_->reset ();
+ size_t no= this->consumer_map_.unbind ((*iter).ext_id_,
+ (*iter).int_id_);
+
+
+ if (no == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "error! ACE_Hash_Map_Manager: unbind ()\n" );
+
+ }
+
+
+
+ this->consumer_map_.close ();
+
+ }
+ }
+
+ this->consumer_map_.close ();
+
+ }*/
+
+ ACE_DEBUG ((LM_DEBUG,
+ "The Callback Quoter server is shutting down"));
+
+ // Instruct the ORB to shutdown.
+ this->orb_->shutdown ();
- // Instruct the ORB to shutdown.
- this->orb_->shutdown ();
}
int
@@ -201,6 +234,14 @@ Notifier_i::Consumer_Data::operator== (const Consumer_Data &rhs)
return this->consumer_->_is_equivalent (rhs.consumer_.in ());
}
+/*CONSUMER_MAP*
+Notifier_i::get_consumer_map_ptr ()
+{
+return (&consumer_map_);
+}
+*/
+
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Node<Notifier_i::Consumer_Data>;
diff --git a/TAO/examples/Callback_Quoter/Notifier_i.h b/TAO/examples/Callback_Quoter/Notifier_i.h
index 4df8c1218e1..e93431ceef1 100644
--- a/TAO/examples/Callback_Quoter/Notifier_i.h
+++ b/TAO/examples/Callback_Quoter/Notifier_i.h
@@ -61,7 +61,11 @@ public:
virtual void shutdown (CORBA::Environment &);
// Shutdown the Notifier.
-private:
+ // CONSUMER_MAP* get_consumer_map_ptr ();
+ // Returns the consumer map ptr.
+
+ //private:
+public:
CORBA::ORB_var orb_;
// The ORB manager.