summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp125
1 files changed, 125 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp
new file mode 100644
index 00000000000..d350c76c677
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_TPC_Factory.cpp
@@ -0,0 +1,125 @@
+// $Id$
+
+#include "EC_TPC_Factory.h"
+
+#include "EC_TPC_Dispatching.h"
+#include "EC_TPC_ProxySupplier.h"
+#include "EC_TPC_ProxyConsumer.h"
+
+#include "tao/ORB_Core.h"
+
+#include "ace/Arg_Shifter.h"
+#include "ace/Sched_Params.h"
+#include "ace/OS_NS_strings.h"
+
+#if ! defined (__ACE_INLINE__)
+#include "EC_TPC_Factory.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(Event, EC_TPC_Factory, "$Id$")
+
+unsigned long EC_TPC_debug_level;
+
+TAO_EC_TPC_Factory::TAO_EC_TPC_Factory (void)
+{
+ EC_TPC_debug_level = 0;
+}
+
+TAO_EC_TPC_Factory::~TAO_EC_TPC_Factory (void)
+{
+}
+
+int
+TAO_EC_TPC_Factory::init_svcs (void)
+{
+ TAO_EC_Simple_Queue_Full_Action::init_svcs();
+ return ACE_Service_Config::static_svcs ()->
+ insert (&ace_svc_desc_TAO_EC_TPC_Factory);
+}
+
+int
+TAO_EC_TPC_Factory::init (int argc, char* argv[])
+{
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+
+ while (arg_shifter.is_anything_left ())
+ {
+ const char *arg = arg_shifter.get_current ();
+
+ if (ACE_OS::strcasecmp (arg, "-ECDispatching") == 0)
+ {
+ arg_shifter.consume_arg ();
+
+ if (arg_shifter.is_parameter_next ())
+ {
+ // Here we print out a message indicating that this
+ // option isn't valid with this factory and that it's
+ // being ignored.
+
+ ACE_DEBUG ((LM_ERROR,
+ "EC_TPC_Factory - "
+ "-ECDispatching not supported with TPC_Factory; ignoring the option and using thread-per-consumer dispatch strategy\n"));
+ arg_shifter.consume_arg ();
+ }
+ }
+ if (ACE_OS::strcasecmp (arg, "-ECTPCDebug") == 0)
+ {
+ arg_shifter.consume_arg ();
+ ++EC_TPC_debug_level;
+ }
+ else
+ {
+ arg_shifter.ignore_arg ();
+ }
+
+ }
+
+ return TAO_EC_Default_Factory::init (argc, argv);
+}
+
+// ****************************************************************
+
+TAO_EC_Dispatching*
+TAO_EC_TPC_Factory::create_dispatching (TAO_EC_Event_Channel_Base *)
+{
+ if (EC_TPC_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_dispatching\n"));
+
+ TAO_EC_Queue_Full_Service_Object* so =
+ this->find_service_object (this->queue_full_service_object_name_.fast_rep(),
+ TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME);
+
+ return new TAO_EC_TPC_Dispatching (so);
+}
+
+
+TAO_EC_ProxyPushSupplier*
+TAO_EC_TPC_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel_Base *ec)
+{
+ if (EC_TPC_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_proxy_push_supplier\n"));
+ return new TAO_EC_TPC_ProxyPushSupplier (ec, this->consumer_validate_connection_);
+}
+
+
+TAO_EC_ProxyPushConsumer*
+TAO_EC_TPC_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel_Base *ec)
+{
+ if (EC_TPC_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_proxy_push_consumer\n"));
+ return new TAO_EC_TPC_ProxyPushConsumer (ec);
+}
+
+
+// ****************************************************************
+
+ACE_STATIC_SVC_DEFINE (TAO_EC_TPC_Factory,
+ ACE_TEXT ("EC_Factory"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (TAO_EC_TPC_Factory),
+ ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
+ 0)
+ACE_FACTORY_DEFINE (TAO_RTEvent_Serv, TAO_EC_TPC_Factory)
+
+// ****************************************************************
+