summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp188
1 files changed, 169 insertions, 19 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp
index a99adabdb47..34332749637 100644
--- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp
+++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp
@@ -2,10 +2,6 @@
#include "Method_Request_Lookup.h"
-#if ! defined (__ACE_INLINE__)
-#include "Method_Request_Lookup.inl"
-#endif /* __ACE_INLINE__ */
-
ACE_RCSID(Notify, TAO_Notify_Method_Request_Lookup, "$Id$")
#include "tao/debug.h"
@@ -15,27 +11,182 @@ ACE_RCSID(Notify, TAO_Notify_Method_Request_Lookup, "$Id$")
#include "Proxy.h"
#include "Admin.h"
#include "SupplierAdmin.h"
-
-TAO_Notify_Method_Request_Lookup::TAO_Notify_Method_Request_Lookup (const TAO_Notify_Event_var& event, TAO_Notify_ProxyConsumer* proxy_consumer)
- : TAO_Notify_Method_Request_Lookup_Base (event, proxy_consumer)
+#include "Event_Manager.h"
+#include "Method_Request_Dispatch.h"
+#include "Delivery_Request.h"
+#include "EventChannelFactory.h"
+
+TAO_Notify_Method_Request_Lookup::TAO_Notify_Method_Request_Lookup (
+ const TAO_Notify_Event * event,
+ TAO_Notify_ProxyConsumer * proxy)
+ : TAO_Notify_Method_Request_Event (event)
+ , proxy_consumer_ (proxy)
{
- this->init (event);
}
TAO_Notify_Method_Request_Lookup::~TAO_Notify_Method_Request_Lookup ()
{
}
+void
+TAO_Notify_Method_Request_Lookup::work (
+ TAO_Notify_ProxySupplier* proxy_supplier
+ ACE_ENV_ARG_DECL)
+{
+ if (delivery_request_.get () == 0)
+ {
+ TAO_Notify_Method_Request_Dispatch_No_Copy request (*this, proxy_supplier, true);
+ proxy_supplier->deliver (request ACE_ENV_ARG_PARAMETER);
+ }
+ else
+ {
+ delivery_request_->dispatch (proxy_supplier, true ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+ }
+}
+
+int TAO_Notify_Method_Request_Lookup::execute_i (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->proxy_consumer_->has_shutdown ())
+ return 0; // If we were shutdown while waiting in the queue, return with no action.
+
+ TAO_Notify_SupplierAdmin* parent = this->proxy_consumer_->supplier_admin ();
+
+ CORBA::Boolean val = this->proxy_consumer_->check_filters (this->event_,
+ parent->filter_admin (),
+ parent->filter_operator ()
+ ACE_ENV_ARG_PARAMETER);
+
+ if (TAO_debug_level > 1)
+ ACE_DEBUG ((LM_DEBUG, "Proxyconsumer %x filter eval result = %d",&this->proxy_consumer_ , val));
+
+ // Filter failed - do nothing.
+ if (val == 0)
+ return 0;
+
+ // The map of subscriptions.
+ TAO_Notify_Consumer_Map* map = this->proxy_consumer_->event_manager ()->consumer_map ();
+
+ TAO_Notify_Consumer_Map::ENTRY* entry = map->find (this->event_->type () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ TAO_Notify_ProxySupplier_Collection* consumers = 0;
+
+ if (entry != 0)
+ {
+ consumers = entry->collection ();
+
+ if (consumers != 0)
+ consumers->for_each (this ACE_ENV_ARG_PARAMETER);
+
+ map->release (entry);
+ }
+
+ // Get the default consumers
+ consumers = map->broadcast_collection ();
+
+ if (consumers != 0)
+ consumers->for_each (this ACE_ENV_ARG_PARAMETER);
+ this->complete ();
+ return 0;
+}
+
+/// Static method used to reconstruct a Method Request Dispatch
+TAO_Notify_Method_Request_Lookup_Queueable *
+TAO_Notify_Method_Request_Lookup::unmarshal (
+ TAO_Notify::Delivery_Request_Ptr & delivery_request,
+ TAO_Notify_EventChannelFactory &ecf,
+ TAO_InputCDR & cdr
+ ACE_ENV_ARG_DECL)
+{
+ bool ok = true;
+ TAO_Notify_Method_Request_Lookup_Queueable * result = 0;
+ CORBA::ULong count;
+ if (cdr.read_ulong (count))
+ {
+ TAO_Notify::IdVec id_path (count);
+ for (size_t nid = 0; ok && nid < count; ++nid)
+ {
+ TAO_Notify_Object::ID id = 0;
+ if ( cdr.read_long (id))
+ {
+ id_path.push_back (id);
+ }
+ else
+ {
+ ok = false;
+ }
+ }
+
+ if (ok)
+ {
+ TAO_Notify_ProxyConsumer * proxy_consumer = ecf.find_proxy_consumer (
+ id_path,
+ 0 ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN(0);
+ if (proxy_consumer != 0)
+ {
+ ACE_NEW_NORETURN (result,
+ TAO_Notify_Method_Request_Lookup_Queueable (delivery_request, proxy_consumer));
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Lookup_No_Copy::unmarshal: unknown proxy id\n")
+ ));
+ }
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Lookup_No_Copy::unmarshal: Cant read proxy id path\n")
+ ));
+ }
+ }
+ return result;
+
+}
+
+
+/****************************************************************/
+
+TAO_Notify_Method_Request_Lookup_Queueable::TAO_Notify_Method_Request_Lookup_Queueable (
+ const TAO_Notify_Event_var& event,
+ TAO_Notify_ProxyConsumer* proxy_consumer)
+ : TAO_Notify_Method_Request_Lookup (event.get (), proxy_consumer)
+ , TAO_Notify_Method_Request_Queueable (event.get ())
+ , event_var_ (event)
+ , proxy_guard_ (proxy_consumer)
+{
+}
+
+TAO_Notify_Method_Request_Lookup_Queueable::TAO_Notify_Method_Request_Lookup_Queueable (
+ TAO_Notify::Delivery_Request_Ptr & request,
+ TAO_Notify_ProxyConsumer * proxy_consumer)
+ : TAO_Notify_Method_Request_Lookup (request->event ().get (), proxy_consumer)
+ , TAO_Notify_Method_Request_Queueable (request->event ().get ())
+ , event_var_ (request->event ())
+ , proxy_guard_ (proxy_consumer)
+{
+}
+
+
+TAO_Notify_Method_Request_Lookup_Queueable::~TAO_Notify_Method_Request_Lookup_Queueable ()
+{
+}
+
int
-TAO_Notify_Method_Request_Lookup::execute (ACE_ENV_SINGLE_ARG_DECL)
+TAO_Notify_Method_Request_Lookup_Queueable::execute (ACE_ENV_SINGLE_ARG_DECL)
{
return this->execute_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
/******************************************************************************************************/
-TAO_Notify_Method_Request_Lookup_No_Copy::TAO_Notify_Method_Request_Lookup_No_Copy (const TAO_Notify_Event* event, TAO_Notify_ProxyConsumer* proxy_consumer)
- : TAO_Notify_Method_Request_Lookup_No_Copy_Base (event, proxy_consumer)
+TAO_Notify_Method_Request_Lookup_No_Copy::TAO_Notify_Method_Request_Lookup_No_Copy (
+ const TAO_Notify_Event* event,
+ TAO_Notify_ProxyConsumer* proxy_consumer)
+ : TAO_Notify_Method_Request_Lookup (event, proxy_consumer)
{
}
@@ -49,23 +200,22 @@ TAO_Notify_Method_Request_Lookup_No_Copy::execute (ACE_ENV_SINGLE_ARG_DECL)
return this->execute_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
-TAO_Notify_Method_Request*
+TAO_Notify_Method_Request_Queueable*
TAO_Notify_Method_Request_Lookup_No_Copy::copy (ACE_ENV_SINGLE_ARG_DECL)
{
- TAO_Notify_Method_Request* request;
+ TAO_Notify_Method_Request_Queueable* request;
- TAO_Notify_Event* event_copy = this->event_->copy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ TAO_Notify_Event_var event_var;
+ this->event_->queueable_copy (event_var ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
- TAO_Notify_Event_Copy_var event_var (event_copy);
-
ACE_NEW_THROW_EX (request,
- TAO_Notify_Method_Request_Lookup (event_var, this->proxy_consumer_),
+ TAO_Notify_Method_Request_Lookup_Queueable (event_var, this->proxy_consumer_),
CORBA::INTERNAL ());
return request;
}
-
+#if 0
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class TAO_Notify_Method_Request_Lookup_T<const TAO_Notify_Event_var
@@ -89,5 +239,5 @@ template class TAO_Notify_Method_Request_Lookup_T<const TAO_Notify_Event*
, TAO_Notify_ProxyConsumer*
, const TAO_Notify_Event*
, TAO_Notify_ProxyConsumer*>
-
+#endif
#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */