diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs')
87 files changed, 1834 insertions, 347 deletions
diff --git a/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp b/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp index 3d2363cb364..f3a59934841 100644 --- a/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp @@ -879,7 +879,7 @@ TAO_StreamCtrl::bind (AVStreams::StreamEndPoint_A_ptr sep_a, AVStreams::flowSpec a_flows, b_flows; CORBA::Any_var flows_any; flows_any = sep_a_->get_property_value ("Flows"); - AVStreams::flowSpec *temp_flows; + AVStreams::flowSpec *temp_flows = 0; flows_any.in () >>= temp_flows; a_flows = *temp_flows; flows_any = sep_b_->get_property_value ("Flows"); @@ -1068,7 +1068,7 @@ TAO_StreamCtrl::bind (AVStreams::StreamEndPoint_A_ptr sep_a, } CORBA::String_var fep_a_name, fep_b_name; flowname_any = fep_a->get_property_value ("FlowName"); - const char *temp_name; + const char *temp_name = 0; flowname_any.in () >>= temp_name; fep_a_name = CORBA::string_dup (temp_name); flowname_any = fep_b->get_property_value ("FlowName"); @@ -1579,7 +1579,7 @@ TAO_StreamEndPoint::connect (AVStreams::StreamEndPoint_ptr responder, CORBA::Any_var protocols_any = responder->get_property_value ("AvailableProtocols"); AVStreams::protocolSpec peer_protocols; - AVStreams::protocolSpec *temp_protocols; + AVStreams::protocolSpec *temp_protocols = 0; protocols_any.in () >>= temp_protocols; peer_protocols = *temp_protocols; for (u_int i=0;i<peer_protocols.length ();i++) @@ -2211,7 +2211,7 @@ TAO_StreamEndPoint::add_fep_i (AVStreams::FlowEndPoint_ptr fep) CORBA::Any_var flow_name_any = fep->get_property_value ("FlowName"); - const char *tmp; + const char *tmp = 0; flow_name_any >>= tmp; flow_name = CORBA::string_dup (tmp); } @@ -3226,7 +3226,7 @@ TAO_MMDevice::add_fdev (CORBA::Object_ptr fdev_obj) flow_name_any = fdev->get_property_value ("Flow"); - const char *tmp; + const char *tmp = 0; *flow_name_any >>= tmp; flow_name = CORBA::string_dup (tmp); } @@ -3974,7 +3974,7 @@ TAO_FlowEndPoint::set_protocol_restriction (const AVStreams::protocolSpec & prot AvailableProtocols_property <<= protocols; this->define_property ("AvailableProtocols", AvailableProtocols_property); - AVStreams::protocolSpec *temp_spec; + AVStreams::protocolSpec *temp_spec = 0; CORBA::Any_var temp_any = this->get_property_value ("AvailableProtocols"); temp_any.in () >>= temp_spec; if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "%N:%l\n")); @@ -4007,7 +4007,7 @@ TAO_FlowEndPoint::is_fep_compatible (AVStreams::FlowEndPoint_ptr peer_fep) exception_message = "TAO_FlowEndPoint::is_fep_compatible - Format"; format_ptr = this->get_property_value ("Format"); - const char *temp_format; + const char *temp_format = 0; format_ptr.in () >>= temp_format; my_format = CORBA::string_dup (temp_format); // get my peer's format value @@ -4022,7 +4022,7 @@ TAO_FlowEndPoint::is_fep_compatible (AVStreams::FlowEndPoint_ptr peer_fep) // since formats are same, check for a common protocol CORBA::Any_var AvailableProtocols_ptr; AVStreams::protocolSpec my_protocol_spec, peer_protocol_spec; - AVStreams::protocolSpec *temp_protocols;; + AVStreams::protocolSpec *temp_protocols = 0; exception_message = "TAO_FlowEndPoint::is_fep_compatible - AvailableProtocols"; diff --git a/TAO/orbsvcs/orbsvcs/CosNotification.mpc b/TAO/orbsvcs/orbsvcs/CosNotification.mpc index 7bfc36233d4..d4f495778a7 100644 --- a/TAO/orbsvcs/orbsvcs/CosNotification.mpc +++ b/TAO/orbsvcs/orbsvcs/CosNotification.mpc @@ -111,10 +111,11 @@ project(CosNotification_Skel) : orbsvcslib, orbsvcs_output, install, notificatio } } -project(CosNotification_Serv) : orbsvcslib, orbsvcs_output, svc_utils, install, notification_skel, dynamicany, etcl{ +project(CosNotification_Serv) : orbsvcslib, orbsvcs_output, svc_utils, install, notification_skel, dynamicany, etcl, messaging{ sharedname = TAO_CosNotification_Serv dynamicflags = TAO_NOTIFY_SERV_BUILD_DLL tagchecks += Notify + after += Messaging IDL_Files { } @@ -144,6 +145,7 @@ project(CosNotification_Serv) : orbsvcslib, orbsvcs_output, svc_utils, install, Notify/Event_Manager.cpp Notify/Event_Persistence_Factory.cpp Notify/FilterAdmin.cpp + Notify/Validate_Client_Task.cpp Notify/ID_Factory.cpp Notify/Method_Request.cpp Notify/Method_Request_Dispatch.cpp diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp index 7712a54b917..b076949f084 100644 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/ECG_UDP_Receiver.cpp @@ -223,7 +223,7 @@ TAO_ECG_UDP_Receiver::handle_input (ACE_SOCK_Dgram& dgram) { ACE_ERROR ((LM_ERROR, "Caught and swallowed EXCEPTION in " - "ECG_UDP_Receiver::handle_input: %s\n", + "ECG_UDP_Receiver::handle_input: %C\n", ex._info ().c_str ())); } return 0; diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Thread_Flags.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Thread_Flags.cpp index 98a8e5f7ae5..bc3a9cc1947 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Thread_Flags.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Thread_Flags.cpp @@ -74,7 +74,7 @@ TAO_EC_Thread_Flags::parse_symbols (const char* syms) if (tok[0] >= '0' && tok[0] <= '9') // Numeric, so just accept it! { // parse it as a long straight to the flags - + // If somebody specifies the scheduler this way, then they // lose range checking on the priority. Bummer, but those // are the breaks. @@ -112,7 +112,7 @@ TAO_EC_Thread_Flags::parse_symbols (const char* syms) // Ideally this would call some sort of on-error function... // but, it doesn't. ACE_ERROR ((LM_ERROR, - "RTEC (%P|%t) unable to parse %s as a thread flag - skipping\n", + "RTEC (%P|%t) unable to parse %C as a thread flag - skipping\n", tok)); } } diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp index 9d516f16ca3..846388ea8d8 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp @@ -185,7 +185,6 @@ namespace TAO TAO_InputCDR icdr (cdr); CORBA::String_var rep_id; - CORBA::ULong min, cs = 0; if (!(icdr.read_string (rep_id.out ()) && @@ -229,7 +228,7 @@ namespace TAO { IOP::ServiceContext sc; sc.context_id = IOP::FT_GROUP_VERSION; - + if (this->ft_send_extended_sc_) { // We send the whole tagged component as a service context. @@ -243,29 +242,29 @@ namespace TAO TAO_InputCDR cdr (reinterpret_cast<const char*> (tp->component_data.get_buffer ()), tp->component_data.length ()); CORBA::Boolean byte_order; - - if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + + if (!(cdr >> ACE_InputCDR::to_boolean (byte_order))) return; - + cdr.reset_byte_order (static_cast<int> (byte_order)); - + FT::TagFTGroupTaggedComponent gtc; - - if ((cdr >> gtc) == 0) + + if (!(cdr >> gtc)) throw CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, CORBA::COMPLETED_NO); - + TAO_OutputCDR ocdr; if (!(ocdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))) return; - + if (!(ocdr << gtc.object_group_ref_version)) return; - + CORBA::ULong length = static_cast<CORBA::ULong> (ocdr.total_length ()); sc.context_data.length (length); CORBA::Octet *buf = sc.context_data.get_buffer (); - + for (const ACE_Message_Block *i = ocdr.begin (); i != 0; i = i->cont ()) @@ -357,7 +356,6 @@ namespace TAO catch (const CORBA::Exception&) { } - return; } TimeBase::TimeT @@ -375,8 +373,7 @@ namespace TAO if (p.in ()) { - t = - p->request_duration_policy_value (); + t = p->request_duration_policy_value (); } else { diff --git a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp index 5c6b3cf6212..142cc8f5a08 100644 --- a/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp +++ b/TAO/orbsvcs/orbsvcs/FaultTolerance/FT_Invocation_Endpoint_Selectors.cpp @@ -31,23 +31,20 @@ TAO_FT_Invocation_Endpoint_Selector::select_endpoint ( TAO::Profile_Transport_Resolver *r, ACE_Time_Value *val) { - bool retval = - this->select_primary (r, - val); + bool retval = this->select_primary (r, val); if (retval) return; - retval = - this->select_secondary (r, - val); + retval = this->select_secondary (r, val); - if (retval == false) - { - // If we get here, we completely failed to find an endpoint selector - // that we know how to use, so throw an exception. - throw CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); - } + // If we get here and still haven't found a primary or + // secondary then we used to throw a TRANSIENT exception here. + // But that would prevent any request interception points + // being called. They may know how to fix the problem so + // we wait to throw the exception in + // Synch_Twoway_Invocation::remote_twoway and + // Synch_Oneway_Invocation::remote_oneway instead. return; } @@ -69,9 +66,8 @@ TAO_FT_Invocation_Endpoint_Selector::select_primary ( if (prof_list == 0) return false; - // Did not succeed. Try to look for primaries all over the place - CORBA::ULong sz = - prof_list->size (); + // Try to look for primaries all over the place + CORBA::ULong const sz = prof_list->size (); // Iterate through the list in a circular fashion. Stop one before // the list instead of trying the same thing again. @@ -84,7 +80,7 @@ TAO_FT_Invocation_Endpoint_Selector::select_primary ( bool retval = this->check_profile_for_primary (tmp); - // Choose a non-primary + // Found a primary if (retval == true && tmp != 0) { retval = @@ -92,7 +88,7 @@ TAO_FT_Invocation_Endpoint_Selector::select_primary ( tmp, max_wait_time); - if (retval == true) + if (retval) return true; } } @@ -118,8 +114,7 @@ TAO_FT_Invocation_Endpoint_Selector::select_secondary ( if (prof_list == 0) return false; - CORBA::ULong sz = - prof_list->size (); + CORBA::ULong const sz = prof_list->size (); for (CORBA::ULong i = 0; i != sz; @@ -131,7 +126,7 @@ TAO_FT_Invocation_Endpoint_Selector::select_secondary ( bool retval = this->check_profile_for_primary (tmp); - // Choose a non-primary + // Found a non-primary if (retval == false && tmp != 0) { retval = @@ -189,7 +184,7 @@ bool TAO_FT_Invocation_Endpoint_Selector::check_profile_for_primary ( TAO_Profile *pfile) { - if (pfile == 0) + if (!pfile) return false; IOP::TaggedComponent tagged_component; diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp index f9e57d5a2d4..e8b9460fda3 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.cpp @@ -194,37 +194,6 @@ TAO::HTIOP::Transport::send_message (TAO_OutputCDR &stream, } int -TAO::HTIOP::Transport::generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg) -{ - // Check whether we have a Bi Dir HTIOP policy set, whether the - // messaging objects are ready to handle bidirectional connections - // and also make sure that we have not recd. or sent any information - // regarding this before... - if (this->orb_core ()->bidir_giop_policy () && - this->messaging_object ()->is_ready_for_bidirectional (msg) && - this->bidirectional_flag () < 0) - { - this->set_bidir_context_info (opdetails); - - // Set the flag to 1 (i.e., originating side) - this->bidirectional_flag (1); - - // At the moment we enable BiDIR giop we have to get a new - // request id to make sure that we follow the even/odd rule - // for request id's. We only need to do this when enabled - // it, after that the Transport Mux Strategy will make sure - // that the rule is followed - opdetails.request_id (this->tms ()->request_id ()); - } - - return TAO_Transport::generate_request_header (opdetails, - spec, - msg); -} - -int TAO::HTIOP::Transport::tear_listen_point_list (TAO_InputCDR &cdr) { CORBA::Boolean byte_order; @@ -248,8 +217,6 @@ TAO::HTIOP::Transport::tear_listen_point_list (TAO_InputCDR &cdr) void TAO::HTIOP::Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) { - ACE_UNUSED_ARG (opdetails); - // Get a handle to the acceptor registry TAO_Acceptor_Registry &ar = this->orb_core ()->lane_resources ().acceptor_registry (); @@ -264,7 +231,7 @@ TAO::HTIOP::Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) acceptor++) { // Check whether it is a HTIOP acceptor - if ((*acceptor)->tag () == OCI_TAG_HTIOP_PROFILE) + if ((*acceptor)->tag () == this->tag ()) { if (this->get_listen_point (listen_point_list, *acceptor) == -1) @@ -283,13 +250,12 @@ TAO::HTIOP::Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) TAO_OutputCDR cdr; // Marshall the information into the stream - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (cdr << listen_point_list) == 0) + if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(cdr << listen_point_list)) return; // Add this info in to the svc_list - opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP, - cdr); + opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP, cdr); return; } diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.h b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.h index 51b035662ce..242d7c16eea 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.h +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Transport.h @@ -114,13 +114,6 @@ namespace TAO TAO_TWOWAY_REQUEST, ACE_Time_Value *max_time_wait = 0); - // @@ This is probably not needed - Priyanka - // This is needed because we want to send additional information - // such as session id etc. in the header. - virtual int generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg); - virtual int tear_listen_point_list (TAO_InputCDR &cdr); virtual TAO_Connection_Handler * connection_handler_i (void); diff --git a/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp index d9948085b90..532c7b4c749 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/ConstantDef_i.cpp @@ -196,7 +196,6 @@ TAO_ConstantDef_i::value_i (void) CORBA::NO_MEMORY ()); retval->replace (impl); - safety.release (); return retval; } @@ -243,6 +242,7 @@ TAO_ConstantDef_i::value_i (const CORBA::Any &value) TAO_InputCDR in (out); mb = in.steal_contents (); } + ACE_Auto_Ptr<ACE_Message_Block> safe (mb); CORBA::TCKind kind = val_tc->kind (); diff --git a/TAO/orbsvcs/orbsvcs/IFRService/Contained_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/Contained_i.cpp index b378fe7f12a..85832e59248 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/Contained_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/Contained_i.cpp @@ -598,9 +598,10 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, } case CORBA::dk_Native: { - container_impl.create_native_i (new_id.c_str (), - new_name, - new_version); + CORBA::NativeDef_var new_defn = + container_impl.create_native_i (new_id.c_str (), + new_name, + new_version); break; } case CORBA::dk_ValueBox: @@ -613,9 +614,9 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, CORBA::ValueBoxDef_var new_defn = container_impl.create_value_box_i (new_id.c_str (), - new_name, - new_version, - otype.in ()); + new_name, + new_version, + otype.in ()); ACE_TString new_path = TAO_IFR_Service_Utils::reference_to_path (new_defn.in ()); @@ -750,11 +751,12 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, CORBA::Any_var value = impl.value_i (); - container_impl.create_constant_i (new_id.c_str (), - new_name, - new_version, - type_def.in (), - value.in ()); + CORBA::ConstantDef_var new_defn = + container_impl.create_constant_i (new_id.c_str (), + new_name, + new_version, + type_def.in (), + value.in ()); break; } case CORBA::dk_Attribute: @@ -773,11 +775,12 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, TAO_InterfaceDef_i idef (this->repo_); idef.section_key (container_key); - idef.create_attribute_i (new_id.c_str (), - new_name, - new_version, - type_def.in (), - mode); + CORBA::AttributeDef_var new_defn = + idef.create_attribute_i (new_id.c_str (), + new_name, + new_version, + type_def.in (), + mode); break; } else if (container_dk == CORBA::dk_Value) @@ -785,11 +788,12 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, TAO_ValueDef_i vdef (this->repo_); vdef.section_key (container_key); - vdef.create_attribute_i (new_id.c_str (), - new_name, - new_version, - type_def.in (), - mode); + CORBA::AttributeDef_var new_defn = + vdef.create_attribute_i (new_id.c_str (), + new_name, + new_version, + type_def.in (), + mode); break; } else @@ -824,14 +828,15 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, TAO_InterfaceDef_i idef (this->repo_); idef.section_key (container_key); - idef.create_operation_i (new_id.c_str (), - new_name, - new_version, - result.in (), - mode, - params.in (), - exceptions.in (), - contexts.in ()); + CORBA::OperationDef_var new_defn = + idef.create_operation_i (new_id.c_str (), + new_name, + new_version, + result.in (), + mode, + params.in (), + exceptions.in (), + contexts.in ()); break; } else if (container_dk == CORBA::dk_Value) @@ -839,14 +844,15 @@ TAO_Contained_i::move_i (CORBA::Container_ptr new_container, TAO_ValueDef_i vdef (this->repo_); impl.section_key (container_key); - vdef.create_operation_i (new_id.c_str (), - new_name, - new_version, - result.in (), - mode, - params.in (), - exceptions.in (), - contexts.in ()); + CORBA::OperationDef_var new_defn = + vdef.create_operation_i (new_id.c_str (), + new_name, + new_version, + result.in (), + mode, + params.in (), + exceptions.in (), + contexts.in ()); break; } else diff --git a/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp b/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp index 7abc1365f09..88b28241e80 100644 --- a/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp +++ b/TAO/orbsvcs/orbsvcs/IFRService/Container_i.cpp @@ -844,6 +844,7 @@ TAO_Container_i::create_constant_i (const char *id, TAO_InputCDR in (out); mb = in.steal_contents (); } + ACE_Auto_Ptr<ACE_Message_Block> safe (mb); CORBA::TypeCode_var val_tc = value.type (); diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp index 2760bbf711e..cc0788b558a 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp +++ b/TAO/orbsvcs/orbsvcs/Log/Log_Constraint_Visitors.cpp @@ -860,15 +860,18 @@ TAO_Log_Constraint_Visitor::visit_binary_op ( this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_LE: - result = left_operand <= right_operand; + //result = left_operand <= right_operand; // Compile error on LynxOS + result = left_operand.operator<= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_GT: - result = left_operand > right_operand; + //result = left_operand > right_operand; // Compile error on LynxOS + result = left_operand.operator> (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_GE: - result = left_operand >= right_operand; + //result = left_operand >= right_operand; // Compile error on LynxOS + result = left_operand.operator>= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_EQ: @@ -876,7 +879,8 @@ TAO_Log_Constraint_Visitor::visit_binary_op ( this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_NE: - result = left_operand != right_operand; + //result = left_operand != right_operand; // Compile error on LynxOS + result = left_operand.operator!= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_PLUS: diff --git a/TAO/orbsvcs/orbsvcs/Makefile.am b/TAO/orbsvcs/orbsvcs/Makefile.am index 0bf28dea9b4..e729c32dcf9 100644 --- a/TAO/orbsvcs/orbsvcs/Makefile.am +++ b/TAO/orbsvcs/orbsvcs/Makefile.am @@ -2209,6 +2209,7 @@ libTAO_CosNotification_Serv_la_SOURCES = \ Notify/Topology_Loader.cpp \ Notify/Topology_Object.cpp \ Notify/Topology_Saver.cpp \ + Notify/Validate_Client_Task.cpp \ Notify/Worker_Task.cpp libTAO_CosNotification_Serv_la_LDFLAGS = \ @@ -2336,6 +2337,7 @@ nobase_include_HEADERS += \ Notify/Topology_Object.h \ Notify/Topology_Object.inl \ Notify/Topology_Saver.h \ + Notify/Validate_Client_Task.h \ Notify/Worker_Task.h \ Notify/notify_serv_export.h diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp index a0969d81032..6580e815f82 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp @@ -1,5 +1,6 @@ // $Id$ #include "orbsvcs/Notify/Admin.h" +#include "orbsvcs/Notify/Validate_Worker_T.h" #if ! defined (__ACE_INLINE__) #include "orbsvcs/Notify/Admin.inl" @@ -54,6 +55,8 @@ TAO_Notify_Admin::init (TAO_Notify::Topology_Parent* parent) this->ec_.reset (dynamic_cast<TAO_Notify_EventChannel *>(parent)); ACE_ASSERT (this->ec_.get() != 0); + filter_admin_.event_channel (this->ec_.get ()); + // this-> on the following line confuses VC6 initialize (parent); @@ -217,4 +220,13 @@ TAO_Notify_Admin::reconnect (void) this->proxy_container().collection()->for_each(&wrk); } +void +TAO_Notify_Admin::validate () +{ + TAO_Notify::Validate_Worker<TAO_Notify_Proxy> wrk; + this->proxy_container().collection()->for_each(&wrk); +} + + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.h b/TAO/orbsvcs/orbsvcs/Notify/Admin.h index 62037ff3c31..1962d352465 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Admin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.h @@ -84,6 +84,8 @@ public: CORBA::Long id, const TAO_Notify::NVPList& attrs); virtual void reconnect (void); + virtual void validate (); + void set_default (bool is_default); bool is_default () const; virtual void load_attrs(const TAO_Notify::NVPList& attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp index 0e8748971d8..bc2f3b9dca9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp @@ -75,4 +75,21 @@ TAO_Notify_CosEC_ProxyPushConsumer::get_proxy_type_name (void) const return "ec_proxy_push_consumer"; } +void +TAO_Notify_CosEC_ProxyPushConsumer::validate () +{ + TAO_Notify_Supplier* sup = this->supplier (); + if (sup != 0 && ! sup->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_CosEC_ProxyPushConsumer::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_push_consumer (); + } +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h index cafba3d2966..709814adafc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h @@ -50,6 +50,7 @@ public: virtual const char * get_proxy_type_name (void) const; + virtual void validate (); protected: ///= CosNotifyChannelAdmin::ProxyPushConsumer methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp index ed6577d57fa..9d5a71b02ee 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp @@ -52,4 +52,20 @@ TAO_Notify_CosEC_ProxyPushSupplier::get_proxy_type_name (void) const return "ec_proxy_push_supplier"; } +void +TAO_Notify_CosEC_ProxyPushSupplier::validate () +{ + TAO_Notify_Consumer* con = this->consumer (); + if (con != 0 && ! con->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_CosEC_ProxyPushSupplier::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + this->disconnect_push_supplier (); + } +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h index 8ae6fee1b81..3c3126755f3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h @@ -63,6 +63,8 @@ public: virtual void disconnect_push_supplier ( ); + virtual void validate (); + private: /// Release virtual void release (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp index c710bc98b03..71ea3de5a78 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp @@ -79,6 +79,23 @@ TAO_Notify_ProxyPushConsumer::get_proxy_type_name (void) const } void +TAO_Notify_ProxyPushConsumer::validate () +{ + TAO_Notify_Supplier* sup = this->supplier (); + if (sup != 0 && ! sup->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_ProxyPushConsumer::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + this->disconnect_push_consumer (); + } +} + + +void TAO_Notify_ProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h index 5282b4807d9..107abc5326d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h @@ -55,6 +55,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); protected: ///= CosNotifyChannelAdmin::ProxyPushConsumer methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp index 02cb590b026..3f2686319fa 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp @@ -61,6 +61,23 @@ TAO_Notify_ProxyPushSupplier::get_proxy_type_name (void) const } void +TAO_Notify_ProxyPushSupplier::validate () +{ + TAO_Notify_Consumer* con = this->consumer (); + if (con != 0 && ! con->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_ProxyPushSupplier::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_push_supplier (); + } +} + +void TAO_Notify_ProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h index 777422bf456..87bea7a33b6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h @@ -58,6 +58,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); // = Interface methods virtual CosNotifyChannelAdmin::ProxyType MyType (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp index 615c364ffef..dd6ec81d500 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp @@ -110,6 +110,7 @@ TAO_Notify_PushConsumer::push (const CORBA::Any& payload) } //--cj end + last_ping_ = ACE_OS::gettimeofday (); this->push_consumer_->push (payload); } @@ -120,6 +121,7 @@ TAO_Notify_PushConsumer::push (const CosNotification::StructuredEvent& event) TAO_Notify_Event::translate (event, any); + last_ping_ = ACE_OS::gettimeofday (); this->push_consumer_->push (any); } @@ -159,4 +161,10 @@ TAO_Notify_PushConsumer::reconnect_from_consumer (TAO_Notify_Consumer* old_consu this->schedule_timer(false); } +CORBA::Object_ptr +TAO_Notify_PushConsumer::get_consumer (void) +{ + return CosEventComm::PushConsumer::_duplicate (this->push_consumer_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h index c06c2dc1b70..0e88ccdfdfc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h @@ -63,6 +63,9 @@ public: TAO_Notify_Consumer* old_consumer); protected: + + virtual CORBA::Object_ptr get_consumer (void); + /// The Consumer CosEventComm::PushConsumer_var push_consumer_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp index fce47748b90..8a7db5acc4f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp @@ -57,4 +57,10 @@ TAO_Notify_PushSupplier::get_ior (void) const return result; } +CORBA::Object_ptr +TAO_Notify_PushSupplier::get_supplier (void) +{ + return CosEventComm::PushSupplier::_duplicate (this->push_supplier_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h index c5f75c1e234..7ffbc3e1463 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h @@ -49,6 +49,9 @@ public: virtual ACE_CString get_ior (void) const; protected: + + virtual CORBA::Object_ptr get_supplier (void); + /// The Supplier CosEventComm::PushSupplier_var push_supplier_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp index 712897a1756..1f4f9076557 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp @@ -166,9 +166,9 @@ TAO_Notify_Builder::~TAO_Notify_Builder () } CosNotifyFilter::FilterFactory_ptr -TAO_Notify_Builder::build_filter_factory (PortableServer::POA_ptr poa) +TAO_Notify_Builder::build_filter_factory (PortableServer::POA_ptr poa, TAO_Notify_FilterFactory*& ff) { - TAO_Notify_FilterFactory* ff = ACE_Dynamic_Service<TAO_Notify_FilterFactory>::instance ("TAO_Notify_FilterFactory"); + ff = ACE_Dynamic_Service<TAO_Notify_FilterFactory>::instance ("TAO_Notify_FilterFactory"); if (ff == 0) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.h b/TAO/orbsvcs/orbsvcs/Notify/Builder.h index 6fe36a0234d..b0fba2e3b29 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.h @@ -61,7 +61,7 @@ public: /// Build the Filter Factory. virtual CosNotifyFilter::FilterFactory_ptr - build_filter_factory (PortableServer::POA_ptr poa); + build_filter_factory (PortableServer::POA_ptr poa, TAO_Notify_FilterFactory*& ff); /// Build EventChannel. virtual CosNotifyChannelAdmin::EventChannel_ptr diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp index 28a5d234bfb..79638daa595 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp @@ -11,11 +11,14 @@ ACE_RCSID (RT_Notify, TAO_Notify_Consumer, "$Id$") #include "orbsvcs/Notify/Timer.h" #include "orbsvcs/Notify/ProxySupplier.h" #include "orbsvcs/Notify/Method_Request_Event.h" +#include "orbsvcs/Notify/QoSProperties.h" +#include "orbsvcs/Notify/Properties.h" #include "orbsvcs/Time_Utilities.h" #include "tao/debug.h" #include "tao/corba.h" +#include "tao/Messaging/Messaging_TypesC.h" #include "ace/Bound_Ptr.h" #include "ace/Unbounded_Queue.h" @@ -42,6 +45,10 @@ TAO_Notify_Consumer::TAO_Notify_Consumer (TAO_Notify_ProxySupplier* proxy) this->pending_events_.reset( pending_events ); this->timer_.reset( this->proxy ()->timer () ); + + // Enable reference counting on the event handler. + this->reference_counting_policy ().value ( + ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } TAO_Notify_Consumer::~TAO_Notify_Consumer () @@ -53,6 +60,18 @@ TAO_Notify_Consumer::~TAO_Notify_Consumer () } } +CORBA::ULong +TAO_Notify_Consumer::_incr_refcnt (void) +{ + return this->add_reference(); +} + +CORBA::ULong +TAO_Notify_Consumer::_decr_refcnt (void) +{ + return this->remove_reference(); +} + TAO_Notify_Proxy* TAO_Notify_Consumer::proxy (void) { @@ -616,6 +635,10 @@ TAO_Notify_Consumer::schedule_timer (bool is_error) static_cast<int> (this->proxy ()->id ()) )); } + if (this->is_suspended()) // double check to avoid race + { + this->cancel_timer(); + } } void @@ -637,14 +660,17 @@ TAO_Notify_Consumer::cancel_timer (void) int TAO_Notify_Consumer::handle_timeout (const ACE_Time_Value&, const void*) { - TAO_Notify_Consumer::Ptr grd (this); - this->timer_id_ = -1; // This must come first, because dispatch_pending may try to resched - try - { - this->dispatch_pending (); - } - catch (...) + if (!this->is_suspended() && this->timer_.isSet() && this->timer_id_ != -1) { + TAO_Notify_Consumer::Ptr grd (this); + this->timer_id_ = -1; // This must come first, because dispatch_pending may try to resched + try + { + this->dispatch_pending (); + } + catch (...) + { + } } return 0; @@ -653,6 +679,7 @@ TAO_Notify_Consumer::handle_timeout (const ACE_Time_Value&, const void*) void TAO_Notify_Consumer::shutdown (void) { + this->suspend(); if (this->timer_.isSet ()) { this->cancel_timer (); @@ -705,6 +732,93 @@ TAO_Notify_Consumer::assume_pending_events (TAO_Notify_Consumer& rhs) // timer value (unless we have a valid pacing interval). this->schedule_timer (); } + if (this->is_suspended()) // double check to avoid race + { + this->cancel_timer(); + } +} + +bool +TAO_Notify_Consumer::is_alive (bool allow_nil_consumer) +{ + bool status = false; + CORBA::Object_var consumer = this->get_consumer (); + if (CORBA::is_nil (consumer.in ())) + { + // The consumer may not connected or the consumer did + // not provide a callback. In this case, the liveliness + // check should return true so it will be validated in + // next period. + if (allow_nil_consumer) + return true; + else + return status; + } + + CORBA::PolicyList policy_list; + try + { + bool do_liveliness_check = false; + ACE_Time_Value now = ACE_OS::gettimeofday (); + + if (CORBA::is_nil (this->rtt_obj_.in ())) + { + // We need to determine if the consumer on the other end is still + // alive. Since we may be in an upcall from the owner of the + // original consumer, we have to put a timeout on the call in case + // the client side is not processing ORB requests at this time. In + // the event that the timeout exception occurs, we will assume that + // the original consumer is still around. If we get any other + // exception we will say that the original consumer is not + // available anymore. + TimeBase::TimeT timeout = 10000000; + CORBA::Any timeout_any; + timeout_any <<= timeout; + + policy_list.length (1); + policy_list[0] = TAO_Notify_PROPERTIES::instance()->orb()-> + create_policy ( + Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, + timeout_any); + rtt_obj_ = + consumer->_set_policy_overrides (policy_list, + CORBA::ADD_OVERRIDE); + + // Clean up the policy that was allocated in the try/catch + for (CORBA::ULong i = 0; i < policy_list.length (); i++) + policy_list[i]->destroy (); + + do_liveliness_check + = (last_ping_ == ACE_Time_Value::zero ? true + : now - last_ping_.value () >= TAO_Notify_PROPERTIES::instance()->validate_client_delay ()); + } + else + do_liveliness_check = + now - last_ping_.value () >= TAO_Notify_PROPERTIES::instance()->validate_client_interval (); + + if (CORBA::is_nil (rtt_obj_.in ())) + status = false; + else if (do_liveliness_check || allow_nil_consumer) + { + last_ping_ = now; + status = !rtt_obj_->_non_existent (); + } + else + status = true; + } + catch (CORBA::TIMEOUT&) + { + status = true; + } + catch (CORBA::Exception& ex) + { + if (DEBUG_LEVEL > 0) + { + ex._tao_print_exception ("TAO_Notify_Consumer::is_alive: false"); + } + } + + return status; } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h index a81c6e22b02..154303efacb 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h @@ -27,7 +27,7 @@ #include "orbsvcs/Notify/Event.h" #include "orbsvcs/Notify/Timer.h" #include "ace/Event_Handler.h" - +#include "ace/Atomic_Op.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -57,12 +57,19 @@ public: }; public: + +typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_Consumer > Ptr; + /// Constructor TAO_Notify_Consumer (TAO_Notify_ProxySupplier* proxy); /// Destructor virtual ~TAO_Notify_Consumer (); + /// This method sigantures deliberately match the RefCounting methods required for ESF Proxy + CORBA::ULong _incr_refcnt (void); + CORBA::ULong _decr_refcnt (void); + /// Access Specific Proxy. TAO_Notify_ProxySupplier* proxy_supplier (void); @@ -110,8 +117,17 @@ public: /// schedule our timer. The caller should have locked the proxy lock /// before calling this method. void assume_pending_events (TAO_Notify_Consumer& rhs); + + /// Is the connected consumer still around? + bool is_alive (bool allow_nil_consumer); + protected: + + /// This method is called by the is_alive() method. It should provide + /// the connected consumer or nil if there is none. + virtual CORBA::Object_ptr get_consumer (void) = 0; + typedef ACE_Unbounded_Queue<TAO_Notify_Method_Request_Event_Queueable *> Request_Queue; DispatchStatus dispatch_request (TAO_Notify_Method_Request_Event * request); @@ -182,10 +198,16 @@ protected: /// The Timer Manager that we use. TAO_Notify_Timer::Ptr timer_; + /// Last time either push an event or validate connection + /// via _non_exist call. + ACE_Atomic_Op<TAO_SYNCH_MUTEX, ACE_Time_Value> last_ping_; + private: /// Events pending to be delivered. ACE_Auto_Ptr< Request_Queue > pending_events_; + + CORBA::Object_var rtt_obj_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp index c8843b836c5..fd77dc396f7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp @@ -267,7 +267,7 @@ TAO_Notify_ConsumerAdmin::add_filter (CosNotifyFilter::Filter_ptr new_filter) { CosNotifyFilter::FilterID fid = this->filter_admin_.add_filter (new_filter); - this->self_change (); + this->self_change (); return fid; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp index b9cfff8d090..261d117eee3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp @@ -180,6 +180,50 @@ TAO_CosNotify_Service::init (int argc, ACE_TCHAR *argv[]) properties->defaultSupplierAdminFilterOp (op); arg_shifter.consume_arg (); } + else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClient")) == 0) + { + arg_shifter.consume_arg (); + TAO_Notify_PROPERTIES::instance()->validate_client (true); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Using reactive client control.\n"))); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClientDelay")) == 0) + { + current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ValidateClientDelay")); + if (current_arg != 0) + { + ACE_Time_Value tv (ACE_OS::atoi (current_arg)); + TAO_Notify_PROPERTIES::instance()->validate_client_delay (tv); + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") + ACE_TEXT ("argument (%s). Ignoring invalid ") + ACE_TEXT ("-ValidateClientDelay usage.\n"), + (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); + } + if (current_arg != 0) + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_TEXT("-ValidateClientInterval")) == 0) + { + current_arg = arg_shifter.get_the_parameter (ACE_TEXT("-ValidateClientInterval")); + if (current_arg != 0) + { + ACE_Time_Value tv (ACE_OS::atoi (current_arg)); + TAO_Notify_PROPERTIES::instance()->validate_client_interval (tv); + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) WARNING: Unrecognized ") + ACE_TEXT ("argument (%s). Ignoring invalid ") + ACE_TEXT ("-ValidateClientDelay usage.\n"), + (current_arg == 0 ? ACE_TEXT ("''") : current_arg))); + } + if (current_arg != 0) + arg_shifter.consume_arg (); + } else { ACE_ERROR ((LM_ERROR, @@ -341,6 +385,12 @@ TAO_CosNotify_Service::finalize_service ( // We're shutting things down, so ignore exceptions } } + + TAO_Notify_EventChannelFactory* necf = + dynamic_cast<TAO_Notify_EventChannelFactory*> (ecf->_servant ()); + if (necf != 0) + necf->stop_validator(); + } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp index 85caa64ae99..f49d421f8da 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp @@ -9,37 +9,130 @@ ACE_RCSID(Notify, #include "ace/Auto_Ptr.h" #include "tao/debug.h" #include "orbsvcs/Notify/Notify_Constraint_Visitors.h" +#include "orbsvcs/Notify/Topology_Saver.h" + +#ifndef DEBUG_LEVEL +# define DEBUG_LEVEL TAO_debug_level +#endif //DEBUG_LEVEL TAO_BEGIN_VERSIONED_NAMESPACE_DECL -TAO_Notify_ETCL_Filter::TAO_Notify_ETCL_Filter (PortableServer::POA_ptr poa) - : constraint_expr_ids_ (0), - poa_ (PortableServer::POA::_duplicate (poa)) +TAO_Notify_Constraint_Expr::TAO_Notify_Constraint_Expr (void) +{ +} + + +TAO_Notify_Constraint_Expr::~TAO_Notify_Constraint_Expr () +{ +} + + +void +TAO_Notify_Constraint_Expr::save_persistent ( + TAO_Notify::Topology_Saver& saver) +{ + CosNotification::EventTypeSeq& event_types = this->constr_expr.event_types; + CORBA::ULong len = event_types.length (); + for (CORBA::ULong i = 0; i < len; ++i) + { + TAO_Notify::NVPList attrs; + bool changed = true; + + attrs.push_back(TAO_Notify::NVP("Domain", event_types[i].domain_name.in())); + attrs.push_back(TAO_Notify::NVP("Type", event_types[i].type_name.in())); + saver.begin_object(0, "EventType", attrs, changed); + saver.end_object(0, "EventType"); + } +} + + +void +TAO_Notify_Constraint_Expr::load_attrs( + const TAO_Notify::NVPList& attrs) +{ + TAO_Notify_Object::load_attrs (attrs); + const char* expr = 0; + if (attrs.find ("Expression", expr)) + { + this->constr_expr.constraint_expr = CORBA::string_dup (expr); + } +} + + +TAO_Notify::Topology_Object* +TAO_Notify_Constraint_Expr::load_child ( + const ACE_CString &type, + CORBA::Long id, + const TAO_Notify::NVPList& attrs) { + ACE_UNUSED_ARG (id); + TAO_Notify::Topology_Object* result = this; + if (type == "EventType") + { + const char* domain = 0; + const char* type = 0; + attrs.find ("Domain", domain); + attrs.find ("Type", type); + + CORBA::ULong len = this->constr_expr.event_types.length (); + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) reload EventType %d \n"), + len + 1)); + + this->constr_expr.event_types.length (len + 1); + this->constr_expr.event_types[len].domain_name = CORBA::string_dup (domain); + this->constr_expr.event_types[len].type_name = CORBA::string_dup (type); + + this->interpreter.build_tree (this->constr_expr); + } + + return result; } + +void +TAO_Notify_Constraint_Expr::release (void) +{ + delete this; + //@@ inform factory +} + + + +TAO_Notify_ETCL_Filter::TAO_Notify_ETCL_Filter (PortableServer::POA_ptr poa, + const char *constraint_grammar, + const TAO_Notify_Object::ID& id) + :constraint_expr_ids_ (0), + poa_ (PortableServer::POA::_duplicate (poa)), + id_ (id), + grammar_ (constraint_grammar) +{ +} + + TAO_Notify_ETCL_Filter::~TAO_Notify_ETCL_Filter () { try { - this->remove_all_constraints (); + this->destroy(); } catch (const CORBA::Exception&) { if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, "Error in Filter dtor\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Error in Filter dtor\n"))); // @@ eat exception. } if (TAO_debug_level > 1) - ACE_DEBUG ((LM_DEBUG, "Filter Destroyed\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Filter Destroyed\n"))); } char* TAO_Notify_ETCL_Filter::constraint_grammar (void) { - return CORBA::string_dup ("ETCL"); + return CORBA::string_dup (this->grammar_.c_str ()); } void @@ -48,33 +141,78 @@ TAO_Notify_ETCL_Filter::add_constraints_i ( { for (CORBA::ULong index = 0; index < constraint_info_seq.length (); ++index) { - TAO_Notify_Constraint_Expr* notify_constr_expr = 0; + this->add_constraint_i (constraint_info_seq[index]); + } +} - ACE_NEW_THROW_EX (notify_constr_expr, - TAO_Notify_Constraint_Expr (), - CORBA::NO_MEMORY ()); - auto_ptr <TAO_Notify_Constraint_Expr> auto_expr (notify_constr_expr); +TAO_Notify_Constraint_Expr* +TAO_Notify_ETCL_Filter::add_constraint_i (CosNotifyFilter::ConstraintID cnstr_id) +{ + TAO_Notify_Constraint_Expr* notify_constr_expr = 0; - const CosNotifyFilter::ConstraintExp& expr = - constraint_info_seq[index].constraint_expression; + ACE_NEW_THROW_EX (notify_constr_expr, + TAO_Notify_Constraint_Expr (), + CORBA::NO_MEMORY ()); + auto_ptr <TAO_Notify_Constraint_Expr> auto_expr (notify_constr_expr); - notify_constr_expr->interpreter. - build_tree (expr.constraint_expr.in ()); + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("Added an empty constraint to filter\n"))); - notify_constr_expr->constr_expr = expr; + if (this->constraint_expr_list_.bind (cnstr_id, notify_constr_expr) == -1) + throw CORBA::INTERNAL (); - CosNotifyFilter::ConstraintID cnstr_id = ++constraint_expr_ids_; + auto_expr.release (); - if (this->constraint_expr_list_.bind (cnstr_id, notify_constr_expr) == -1) - throw CORBA::INTERNAL (); + return notify_constr_expr; +} - if (TAO_debug_level > 1) - ACE_DEBUG ((LM_DEBUG, "Added constraint to filter %x\n", this, expr.constraint_expr.in ())); - auto_expr.release (); - } +void +TAO_Notify_ETCL_Filter::add_constraint_i + (const CosNotifyFilter::ConstraintInfo& constraint, + CosNotifyFilter::ConstraintID cnstr_id + ) +{ + TAO_Notify_Constraint_Expr* notify_constr_expr = 0; + + ACE_NEW_THROW_EX (notify_constr_expr, + TAO_Notify_Constraint_Expr (), + CORBA::NO_MEMORY ()); + auto_ptr <TAO_Notify_Constraint_Expr> auto_expr (notify_constr_expr); + + const CosNotifyFilter::ConstraintExp& expr = + constraint.constraint_expression; + + notify_constr_expr->interpreter. + build_tree (expr); + + notify_constr_expr->constr_expr = expr; + + if (cnstr_id == 0) + { + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Added constraint %s to filter %d\n"), + expr.constraint_expr.in (), this->id_)); + + cnstr_id = ++constraint_expr_ids_; + } + else + { + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Loaded constraint %s to filter %d\n"), + expr.constraint_expr.in (), this->id_)); + } + + if (this->constraint_expr_list_.bind (cnstr_id, notify_constr_expr) == -1) + throw CORBA::INTERNAL (); + + auto_expr.release (); } + CosNotifyFilter::ConstraintInfoSeq* TAO_Notify_ETCL_Filter::add_constraints ( const CosNotifyFilter::ConstraintExpSeq& constraint_list) @@ -85,7 +223,8 @@ TAO_Notify_ETCL_Filter::add_constraints ( CORBA::ULong constraint_length = constraint_list.length (); if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "constraint_length = %d\n", + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("constraint_length = %d\n"), constraint_length)); // Create the list that goes out. @@ -106,7 +245,7 @@ TAO_Notify_ETCL_Filter::add_constraints ( if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - "Adding constraint %d, %s\n", + ACE_TEXT ("Adding constraint %d, %C\n"), pop_index, constraint_list [pop_index].constraint_expr.in ())); } @@ -195,6 +334,8 @@ TAO_Notify_ETCL_Filter::modify_constraints ( { delete constr_saved[index]; } + + this->self_change (); } CosNotifyFilter::ConstraintInfoSeq* @@ -304,11 +445,14 @@ TAO_Notify_ETCL_Filter::destroy (void) ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ()); - this->remove_all_constraints_i (); + if (CORBA::is_nil (this->poa_.in())) + return; - PortableServer::ObjectId_var refTemp = poa_->servant_to_id (this); + this->remove_all_constraints_i (); - poa_->deactivate_object (refTemp.in ()); + PortableServer::ObjectId_var refTemp = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (refTemp.in ()); + this->poa_ = PortableServer::POA::_nil(); } CORBA::Boolean @@ -378,4 +522,94 @@ TAO_Notify_ETCL_Filter::get_callbacks (void) throw CORBA::NO_IMPLEMENT (); } + +void +TAO_Notify_ETCL_Filter::save_persistent (TAO_Notify::Topology_Saver& saver) +{ + TAO_Notify::NVPList attrs; + bool changed = true; + attrs.push_back(TAO_Notify::NVP("FilterId", this->id_)); + attrs.push_back(TAO_Notify::NVP("Grammar", this->constraint_grammar())); + saver.begin_object(0, "filter", attrs, changed); + + { + int index = 0; + CONSTRAINT_EXPR_LIST::ITERATOR iterator (this->constraint_expr_list_); + + for (CONSTRAINT_EXPR_LIST::ENTRY *entry = 0; + iterator.next (entry) != 0; + iterator.advance (), ++index) + { + TAO_Notify::NVPList attrs; + bool changed = true; + attrs.push_back(TAO_Notify::NVP("ConstraintId", entry->ext_id_)); + attrs.push_back(TAO_Notify::NVP("Expression", + entry->int_id_->constr_expr.constraint_expr.in ())); + saver.begin_object(0, "constraint", attrs, changed); + + entry->int_id_->save_persistent (saver); + + saver.end_object(0, "constraint"); + } + + saver.end_object(0, "filter"); + } +} + + +void +TAO_Notify_ETCL_Filter::release (void) +{ + delete this; + //@@ inform factory +} + + +void +TAO_Notify_ETCL_Filter::load_attrs(const TAO_Notify::NVPList& attrs) +{ + const char* value = 0; + TAO_Notify_Object::load_attrs (attrs); + if (attrs.find ("FilterId", value)) + { + ACE_ASSERT (this->id_ == ACE_OS::atoi (value)); + } + + if (attrs.find ("Grammar", value)) + { + this->grammar_ = value; + } +} + +TAO_Notify::Topology_Object* +TAO_Notify_ETCL_Filter::load_child (const ACE_CString &type, + CORBA::Long id, const TAO_Notify::NVPList& attrs) +{ + ACE_UNUSED_ARG (id); + + TAO_Notify::Topology_Object* result = this; + if (type == "constraint") + { + const char* value = 0; + if (attrs.find ("ConstraintId", value)) + { + TAO_Notify_Object::ID id = ACE_OS::atoi (value); + constraint_expr_ids_ = id; + + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) reload filter %d constraint %d\n"), + static_cast<int> (this->id_), static_cast<int> (id))); + + TAO_Notify_Constraint_Expr* expr + = this->add_constraint_i (id); + expr->load_attrs (attrs); + + return expr; + } + } + return result; +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h index 38fb8b0f5cc..3dc1b144832 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h @@ -22,6 +22,7 @@ #include "ace/Atomic_Op.h" #include "orbsvcs/CosNotifyFilterS.h" #include "orbsvcs/Notify/Notify_Constraint_Interpreter.h" +#include "orbsvcs/Notify/Topology_Object.h" #include "ace/Null_Mutex.h" #if defined(_MSC_VER) @@ -31,6 +32,44 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_Notify_ETCL_Filter; + +class TAO_Notify_Constraint_Expr : public TAO_Notify::Topology_Object +{ +public: + + friend class TAO_Notify_ETCL_Filter; + + TAO_Notify_Constraint_Expr (void); + virtual ~TAO_Notify_Constraint_Expr (); + + void save_persistent ( + TAO_Notify::Topology_Saver& saver); + + + void load_attrs( + const TAO_Notify::NVPList& attrs); + + TAO_Notify::Topology_Object* load_child ( + const ACE_CString &type, + CORBA::Long id, + const TAO_Notify::NVPList& attrs); + + +private: + /// Release this object. + virtual void release (void); + + // = DESCRIPTION + // Structure for associating ConstraintInfo with an interpreter. + // + CosNotifyFilter::ConstraintExp constr_expr; + // Constraint Expression. + + TAO_Notify_Constraint_Interpreter interpreter; + // Constraint Interpreter. +}; + /** * @class TAO_ETCL_Filter * @@ -38,15 +77,23 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * */ class TAO_Notify_Serv_Export TAO_Notify_ETCL_Filter - : public POA_CosNotifyFilter::Filter + : public POA_CosNotifyFilter::Filter, + public TAO_Notify::Topology_Object { public: /// Constructor - TAO_Notify_ETCL_Filter (PortableServer::POA_ptr poa); + TAO_Notify_ETCL_Filter (PortableServer::POA_ptr poa, + const char *constraint_grammar, + const TAO_Notify_Object::ID& id); /// Destructor virtual ~TAO_Notify_ETCL_Filter (void); + virtual void save_persistent (TAO_Notify::Topology_Saver& saver); + void load_attrs(const TAO_Notify::NVPList& attrs); + TAO_Notify::Topology_Object* load_child (const ACE_CString &type, + CORBA::Long id, const TAO_Notify::NVPList& attrs); + protected: virtual char * constraint_grammar (void); @@ -76,21 +123,18 @@ protected: virtual CosNotifyFilter::CallbackIDSeq * get_callbacks (void); private: - void add_constraints_i (const CosNotifyFilter::ConstraintInfoSeq& constraint_info_seq); - void remove_all_constraints_i (void); + /// Release this object. + virtual void release (void); + + void add_constraints_i (const CosNotifyFilter::ConstraintInfoSeq& constraint_info_seq); + void add_constraint_i (const CosNotifyFilter::ConstraintInfo& constraint, + CosNotifyFilter::ConstraintID cnstr_id = 0); - /** - * Structure for associating ConstraintInfo with an interpreter. - */ - struct TAO_Notify_Constraint_Expr - { - /// Constraint Expression. - CosNotifyFilter::ConstraintExp constr_expr; + TAO_Notify_Constraint_Expr* + add_constraint_i (CosNotifyFilter::ConstraintID cnstr_id); - /// Constraint Interpreter. - TAO_Notify_Constraint_Interpreter interpreter; - }; + void remove_all_constraints_i (void); /// Lock to serialize access to data members. TAO_SYNCH_MUTEX lock_; @@ -100,13 +144,17 @@ private: /// A list of the constraints stored in this filter. typedef ACE_Hash_Map_Manager <CosNotifyFilter::ConstraintID, - TAO_Notify_ETCL_Filter::TAO_Notify_Constraint_Expr*, + TAO_Notify_Constraint_Expr*, ACE_SYNCH_NULL_MUTEX> CONSTRAINT_EXPR_LIST; CONSTRAINT_EXPR_LIST constraint_expr_list_; PortableServer::POA_var poa_; + + TAO_Notify_Object::ID id_; + + ACE_CString grammar_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp index 2d2b79d9f26..30ce99ba192 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp @@ -5,6 +5,15 @@ ACE_RCSID(Notify, TAO_Notify_ETCL_FilterFactory, "$Id$") #include "orbsvcs/Notify/ETCL_Filter.h" +#include "orbsvcs/Notify/Properties.h" +#include "tao/debug.h" + + +#ifndef DEBUG_LEVEL +# define DEBUG_LEVEL TAO_debug_level +#endif //DEBUG_LEVEL + + TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -15,22 +24,62 @@ TAO_Notify_ETCL_FilterFactory::TAO_Notify_ETCL_FilterFactory (void) : TAO_Notify_ETCL_FilterFactory::~TAO_Notify_ETCL_FilterFactory () { + FILTERMAP::ITERATOR iterator (this->filters_); + + for (FILTERMAP::ENTRY *entry = 0; + iterator.next (entry) != 0; + iterator.advance ()) + { + delete entry->int_id_; + entry->int_id_ = 0; + } + + this->filters_.unbind_all (); + } CosNotifyFilter::FilterFactory_ptr TAO_Notify_ETCL_FilterFactory::create (PortableServer::POA_ptr filter_poa) { - this->filter_poa_ = PortableServer::POA::_duplicate(filter_poa); // save the filter poa. - - PortableServer::ServantBase_var servant_var (this); + this->filter_poa_ = PortableServer::POA::_duplicate(filter_poa); - PortableServer::ObjectId_var id = filter_poa->activate_object (this); + CORBA::Object_var object = CORBA::Object::_nil(); + try + { + PortableServer::ObjectId_var id = filter_poa->activate_object (this); + object = filter_poa->id_to_reference (id.in()); + } + catch (PortableServer::POA::ServantAlreadyActive&) + { + try + { + object = filter_poa->servant_to_reference (this); + } + catch (CORBA::Exception& ) + { + return CosNotifyFilter::FilterFactory::_nil(); + } + } - CORBA::Object_var object = filter_poa->id_to_reference (id.in ()); + return CosNotifyFilter::FilterFactory::_narrow (object.in ()); +} - CosNotifyFilter::FilterFactory_var filter = CosNotifyFilter::FilterFactory::_narrow (object.in ()); +void +TAO_Notify_ETCL_FilterFactory::destroy (void) +{ + if (CORBA::is_nil(this->filter_poa_.in ())) + return; + PortableServer::ServantBase_var guard(this); + try + { + PortableServer::ObjectId_var id = + this->filter_poa_->servant_to_id (this); + this->filter_poa_->deactivate_object (id.in()); + } + catch (CORBA::Exception&) + { + } - return filter._retn(); } CosNotifyFilter::Filter_ptr @@ -42,18 +91,50 @@ TAO_Notify_ETCL_FilterFactory::create_filter (const char *constraint_grammar) ACE_OS::strcmp (constraint_grammar, "EXTENDED_TCL") != 0) throw CosNotifyFilter::InvalidGrammar (); - // Create the RefCounted servant. + TAO_Notify_Object::ID id = filter_ids_.id (); TAO_Notify_ETCL_Filter* filter = 0; + return this->create_filter (constraint_grammar, id, filter); +} - ACE_NEW_THROW_EX (filter, - TAO_Notify_ETCL_Filter (this->filter_poa_.in ()), - CORBA::NO_MEMORY ()); - PortableServer::ServantBase_var filter_var (filter); +CosNotifyFilter::Filter_ptr +TAO_Notify_ETCL_FilterFactory::create_filter ( + const char *constraint_grammar, + const TAO_Notify_Object::ID& id, + TAO_Notify_ETCL_Filter*& filter) +{ + // Create the RefCounted servant. + filter = 0; - PortableServer::ObjectId_var oid = - this->filter_poa_->activate_object (filter); + ACE_NEW_THROW_EX (filter, + TAO_Notify_ETCL_Filter (this->filter_poa_.in (), + constraint_grammar, + id), + CORBA::NO_MEMORY ()); + if (filters_.bind (id, filter) == -1) + { + throw CORBA::INTERNAL (); + return 0; + } + + PortableServer::ObjectId_var oid; + try + { + oid = this->filter_poa_->activate_object (filter); + } + catch (PortableServer::POA::ServantAlreadyActive&) + { + try + { + oid = this->filter_poa_->servant_to_id (filter); + } + catch (CORBA::Exception& ) + { + throw CORBA::INTERNAL (); + return 0; + } + } CORBA::Object_var obj = this->filter_poa_->id_to_reference (oid.in ()); @@ -69,4 +150,110 @@ TAO_Notify_ETCL_FilterFactory::create_mapping_filter (const char * /*constraint_ TAO_END_VERSIONED_NAMESPACE_DECL + +void +TAO_Notify_ETCL_FilterFactory::save_persistent (TAO_Notify::Topology_Saver& saver) +{ + bool changed = true; + TAO_Notify::NVPList attrs; // ECF has no attributes + saver.begin_object(0, "filter_factory", attrs, changed); + + if (this->filters_.current_size () > 0) + { + int index = 0; + FILTERMAP::ITERATOR iterator (this->filters_); + + for (FILTERMAP::ENTRY *entry = 0; + iterator.next (entry) != 0; + iterator.advance (), ++index) + { + entry->int_id_->save_persistent (saver); + } + } + + saver.end_object(0, "filter_factory"); +} + + +TAO_Notify::Topology_Object* +TAO_Notify_ETCL_FilterFactory::load_child (const ACE_CString &type, + CORBA::Long id, const TAO_Notify::NVPList& attrs) +{ + ACE_UNUSED_ARG (id); + + TAO_Notify::Topology_Object* result = this; + if (type == "filter") + { + const char* value = 0; + if (attrs.find ("FilterId", value)) + { + TAO_Notify_Object::ID id = ACE_OS::atoi (value); + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) reload filter %d\n"), + static_cast<int> (id) + )); + + filter_ids_.set_last_used (id); + + TAO_Notify_ETCL_Filter* filter = 0; + this->create_filter (0, id, filter); + filter->load_attrs (attrs); + + return filter; + } + } + return result; +} + + +void +TAO_Notify_ETCL_FilterFactory::release (void) +{ + delete this; + //@@ inform factory +} + + +TAO_Notify_Object::ID +TAO_Notify_ETCL_FilterFactory::get_filter_id (CosNotifyFilter::Filter_ptr filter) +{ + ::PortableServer::Servant svt + = this->filter_poa_->reference_to_servant (filter); + + FILTERMAP::ITERATOR iterator (this->filters_); + + for (FILTERMAP::ENTRY *entry = 0; + iterator.next (entry) != 0; + iterator.advance ()) + { + if (svt == entry->int_id_) + return entry->ext_id_; + } + + throw CORBA::INTERNAL (); + return 0; +} + + +CosNotifyFilter::Filter_ptr +TAO_Notify_ETCL_FilterFactory::get_filter (const TAO_Notify_Object::ID& id) +{ + TAO_Notify_ETCL_Filter* filter = 0; + if (filters_.find (id, filter) == -1) + return CosNotifyFilter::Filter::_nil (); + else + { + CORBA::Object_var obj = + this->filter_poa_->servant_to_reference (filter + ); + + CosNotifyFilter::Filter_var filter + = CosNotifyFilter::Filter::_narrow (obj.in ()); + + return filter._retn (); + } +} + + ACE_FACTORY_DEFINE (TAO_Notify_Serv, TAO_Notify_ETCL_FilterFactory) diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h index 43761ff2456..ce95bb061ea 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h @@ -23,6 +23,10 @@ #include "orbsvcs/CosNotifyFilterS.h" #include "orbsvcs/Notify/FilterFactory.h" +#include "orbsvcs/Notify/ID_Factory.h" +#include "orbsvcs/Notify/ETCL_Filter.h" +#include "orbsvcs/Notify/Topology_Saver.h" + #if defined(_MSC_VER) #pragma warning(push) @@ -53,6 +57,8 @@ public: virtual CosNotifyFilter::FilterFactory_ptr create ( PortableServer::POA_ptr filter_poa); + virtual void destroy (void); + ///= CosNotifyFilter::FilterFactory methods virtual CosNotifyFilter::Filter_ptr create_filter ( @@ -62,9 +68,39 @@ public: const char * constraint_grammar, const CORBA::Any & default_value); + + virtual void save_persistent (TAO_Notify::Topology_Saver& saver); + + virtual TAO_Notify::Topology_Object* load_child ( + const ACE_CString &type, + CORBA::Long id, + const TAO_Notify::NVPList& attrs); + + virtual TAO_Notify_Object::ID get_filter_id (CosNotifyFilter::Filter_ptr filter); + virtual CosNotifyFilter::Filter_ptr get_filter (const TAO_Notify_Object::ID& id); + + protected: + + CosNotifyFilter::Filter_ptr + create_filter (const char *constraint_grammar, + const TAO_Notify_Object::ID& id, + TAO_Notify_ETCL_Filter*& filter); + + /// Release this object. + virtual void release (void); + /// The POA in which to activate the Filters. PortableServer::POA_var filter_poa_; + + /// Id generator for proxy suppliers + TAO_Notify_ID_Factory filter_ids_; + + typedef ACE_Hash_Map_Manager <TAO_Notify_Object::ID, + TAO_Notify_ETCL_Filter*, + TAO_SYNCH_MUTEX> FILTERMAP; + + FILTERMAP filters_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp index ca5fed68302..3e5e7aed22b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp @@ -17,6 +17,7 @@ #include "orbsvcs/Notify/Proxy.h" #include "orbsvcs/Notify/Event_Manager.h" #include "orbsvcs/Notify/POA_Helper.h" +#include "orbsvcs/Notify/Validate_Worker_T.h" #include "tao/debug.h" //#define DEBUG_LEVEL 9 @@ -48,6 +49,7 @@ TAO_Notify_EventChannel::TAO_Notify_EventChannel (void) , ca_container_ (0) , sa_container_ (0) , default_filter_factory_ (CosNotifyFilter::FilterFactory::_nil ()) + , default_filter_factory_servant_ (0) { } @@ -110,14 +112,17 @@ TAO_Notify_EventChannel::init (TAO_Notify_EventChannelFactory* ecf this->set_admin (initial_admin); - PortableServer::POA_var default_poa = TAO_Notify_PROPERTIES::instance ()->default_poa (); + PortableServer::POA_var default_poa = + TAO_Notify_PROPERTIES::instance ()->default_poa (); + this->default_filter_factory_ = - TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory (default_poa.in()); + TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory ( + default_poa.in(), this->default_filter_factory_servant_); - // Note originally default admins were allocated here, bt this caused problems - // attempting to save the topology changes before the Event Channel was completely - // constructed and linked to the ECF. - // Lazy evaluation also avoids creating unneded admins. + // Note originally default admins were allocated here, bt this + // caused problems attempting to save the topology changes before + // the Event Channel was completely constructed and linked to the + // ECF. Lazy evaluation also avoids creating unneded admins. } @@ -172,7 +177,8 @@ TAO_Notify_EventChannel::init (TAO_Notify::Topology_Parent* parent) PortableServer::POA_var default_poa = TAO_Notify_PROPERTIES::instance ()->default_poa (); this->default_filter_factory_ = - TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory (default_poa.in ()); + TAO_Notify_PROPERTIES::instance()->builder()->build_filter_factory ( + default_poa.in(), this->default_filter_factory_servant_); } @@ -235,6 +241,8 @@ TAO_Notify_EventChannel::destroy (void) this->ca_container_.reset( 0 ); this->default_filter_factory_ = CosNotifyFilter::FilterFactory::_nil(); + + this->default_filter_factory_servant_->destroy(); } void @@ -325,6 +333,12 @@ TAO_Notify_EventChannel::default_filter_factory (void) return CosNotifyFilter::FilterFactory::_duplicate (this->default_filter_factory_.in ()); } +TAO_Notify_FilterFactory* +TAO_Notify_EventChannel::default_filter_factory_servant () const +{ + return this->default_filter_factory_servant_; +} + ::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_Notify_EventChannel::new_for_consumers (CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id) @@ -442,6 +456,8 @@ TAO_Notify_EventChannel::save_persistent (TAO_Notify::Topology_Saver& saver) bool want_all_children = saver.begin_object( this->id(), "channel", attrs, changed); + + this->default_filter_factory_servant_->save_persistent (saver); TAO_Notify::Save_Persist_Worker<TAO_Notify_ConsumerAdmin> ca_wrk(saver, want_all_children); @@ -487,16 +503,21 @@ TAO_Notify_EventChannel::load_attrs(const TAO_Notify::NVPList& attrs) TAO_Notify::Topology_Object * TAO_Notify_EventChannel::load_child (const ACE_CString &type, - CORBA::Long id, - const TAO_Notify::NVPList& attrs) + CORBA::Long id, + const TAO_Notify::NVPList& attrs) { TAO_Notify::Topology_Object* result = this; - if (type == "consumer_admin") + if (type == "filter_factory") + { + return this->default_filter_factory_servant_; + } + else if (type == "consumer_admin") { - if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) EventChannel reload consumer_admin %d\n") - , static_cast<int> (id) - )); + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) EventChannel reload consumer_admin %d\n") + , static_cast<int> (id) + )); // call special builder method to reload TAO_Notify_Builder* bld = TAO_Notify_PROPERTIES::instance()->builder(); @@ -515,10 +536,11 @@ TAO_Notify_EventChannel::load_child (const ACE_CString &type, } else if (type == "supplier_admin") { - if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) EventChannel reload supplier_admin %d\n") - , static_cast<int> (id) - )); + if (DEBUG_LEVEL) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) EventChannel reload supplier_admin %d\n") + , static_cast<int> (id) + )); TAO_Notify_Builder* bld = TAO_Notify_PROPERTIES::instance()->builder(); TAO_Notify_SupplierAdmin * sa = bld->build_supplier_admin ( @@ -597,4 +619,17 @@ TAO_Notify_EventChannel::sa_container() return *sa_container_; } + +void +TAO_Notify_EventChannel::validate () +{ + TAO_Notify::Validate_Worker<TAO_Notify_ConsumerAdmin> ca_wrk; + this->ca_container().collection()->for_each(&ca_wrk); + + TAO_Notify::Validate_Worker<TAO_Notify_SupplierAdmin> sa_wrk; + this->sa_container().collection()->for_each(&sa_wrk); +} + + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h index f1db9a72c67..e5384c7bbae 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h @@ -24,9 +24,11 @@ #include "orbsvcs/Notify/Topology_Object.h" #include "orbsvcs/Notify/Object.h" #include "orbsvcs/Notify/EventChannelFactory.h" +#include "orbsvcs/Notify/FilterFactory.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_Notify_FilterFactory; class TAO_Notify_ConsumerAdmin; class TAO_Notify_SupplierAdmin; class TAO_Notify_EventChannelFactory; @@ -87,6 +89,7 @@ public: CORBA::Long id, const TAO_Notify::NVPList& attrs); virtual void reconnect (void); + virtual void validate (); virtual TAO_Notify_Object::ID get_id () const {return id();} @@ -113,6 +116,8 @@ public: virtual CosNotifyChannelAdmin::SupplierAdmin_ptr get_supplieradmin (CosNotifyChannelAdmin::AdminID id); + TAO_Notify_FilterFactory* default_filter_factory_servant () const; + private: typedef TAO_Notify_Container_T <TAO_Notify_ConsumerAdmin> TAO_Notify_ConsumerAdmin_Container; typedef TAO_Notify_Container_T <TAO_Notify_SupplierAdmin> TAO_Notify_SupplierAdmin_Container; @@ -179,8 +184,8 @@ private: /// The default filter factory. CosNotifyFilter::FilterFactory_var default_filter_factory_; + TAO_Notify_FilterFactory * default_filter_factory_servant_; - /// Release virtual void release (void); }; diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp index d958167541c..e615a5c588a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp @@ -20,6 +20,9 @@ ACE_RCSID(Notify, #include "orbsvcs/Notify/Find_Worker_T.h" #include "orbsvcs/Notify/Seq_Worker_T.h" #include "orbsvcs/Notify/POA_Helper.h" +#include "orbsvcs/Notify/Validate_Worker_T.h" +#include "orbsvcs/Notify/Validate_Client_Task.h" +#include "orbsvcs/Notify/FilterFactory.h" #include "ace/Dynamic_Service.h" @@ -79,6 +82,8 @@ TAO_Notify_EventChannelFactory::destroy (void) void TAO_Notify_EventChannelFactory::init (PortableServer::POA_ptr poa) { + this->poa_ = PortableServer::POA::_duplicate (poa); + ACE_ASSERT (this->ec_container_.get() == 0); // Init ec_container_ @@ -116,6 +121,17 @@ TAO_Notify_EventChannelFactory::init (PortableServer::POA_ptr poa) this->load_topology (); this->load_event_persistence (); + + if (TAO_Notify_PROPERTIES::instance()->validate_client() == true) + { + TAO_Notify_validate_client_Task* validate_client_task = 0; + ACE_NEW_THROW_EX (validate_client_task, + TAO_Notify_validate_client_Task (TAO_Notify_PROPERTIES::instance()->validate_client_delay (), + TAO_Notify_PROPERTIES::instance()->validate_client_interval (), + this), + CORBA::INTERNAL ()); + this->validate_client_task_.reset (validate_client_task); + } } void @@ -147,6 +163,8 @@ TAO_Notify_EventChannelFactory::remove (TAO_Notify_EventChannel* event_channel) int TAO_Notify_EventChannelFactory::shutdown (void) { + this->stop_validator(); + if (TAO_Notify_Object::shutdown () == 1) return 1; @@ -155,6 +173,7 @@ TAO_Notify_EventChannelFactory::shutdown (void) return 0; } + CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_named_channel ( const CosNotification::QoSProperties& initial_qos, @@ -165,6 +184,7 @@ TAO_Notify_EventChannelFactory::create_named_channel ( return this->create_channel (initial_qos, initial_admin, id); } + ::CosNotifyChannelAdmin::EventChannel_ptr TAO_Notify_EventChannelFactory::create_channel ( const CosNotification::QoSProperties & initial_qos, const CosNotification::AdminProperties & initial_admin, @@ -228,6 +248,24 @@ TAO_Notify_EventChannelFactory::load_topology (void) } this->loading_topology_ = false; } + +void +TAO_Notify_EventChannelFactory::validate () +{ + TAO_Notify::Validate_Worker<TAO_Notify_EventChannel> wrk; + + this->ec_container().collection()->for_each(&wrk); +} + +void +TAO_Notify_EventChannelFactory::stop_validator () +{ + if (this->validate_client_task_.get () != 0) + { + this->validate_client_task_->shutdown (); + } +} + bool TAO_Notify_EventChannelFactory::is_persistent () const { @@ -502,4 +540,5 @@ TAO_Notify_EventChannelFactory::ec_container() return *ec_container_; } + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h index 5eaf5d049f1..cc120bae4dd 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h @@ -24,12 +24,17 @@ #include "orbsvcs/Notify/Topology_Factory.h" #include "orbsvcs/Notify/Reconnection_Registry.h" #include "orbsvcs/Notify/Routing_Slip.h" +#include "orbsvcs/Notify/Validate_Client_Task.h" +#include "orbsvcs/Notify/Name_Value_Pair.h" #include "orbsvcs/CosNotifyChannelAdminS.h" #include "orbsvcs/NotifyExtS.h" +#include "ace/Auto_Ptr.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_Notify_FilterFactory; + #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4250) @@ -47,7 +52,6 @@ template <class TYPE> class TAO_Notify_Container_T; class TAO_Notify_Serv_Export TAO_Notify_EventChannelFactory : public virtual POA_NotifyExt::EventChannelFactory , public TAO_Notify::Topology_Parent - { friend class TAO_Notify_Builder; typedef ACE_Unbounded_Set <TAO_Notify::Routing_Slip_Ptr> Routing_Slip_Set; @@ -103,6 +107,10 @@ public: const TAO_Notify::NVPList& attrs); CosNotifyChannelAdmin::EventChannelFactory_ptr activate_self (void); virtual void reconnect (void); + virtual void validate (); + + /// at shutdown time, this causes the validator thread to exit. + void stop_validator (void); /// Handle change notifications bool handle_change (void); @@ -170,6 +178,9 @@ private: /// Release this object. virtual void release (void); + ACE_Auto_Ptr <TAO_Notify_validate_client_Task> validate_client_task_; + + PortableServer::POA_var poa_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.h b/TAO/orbsvcs/orbsvcs/Notify/EventType.h index f249ff18a3c..f9c74ef2323 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventType.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.h @@ -80,6 +80,9 @@ public: virtual void save_persistent (TAO_Notify::Topology_Saver& saver); protected: + + friend class TAO_Notify_Constraint_Interpreter; + /// Init this object. void init_i (const char* domain_name, const char* type_name); diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp index 53f080b262f..47debb424d5 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp @@ -10,6 +10,8 @@ ACE_RCSID(Notify, FilterAdmin, "$Id$") #include "orbsvcs/Notify/Topology_Saver.h" #include "orbsvcs/Notify/Properties.h" +#include "orbsvcs/Notify/EventChannelFactory.h" +#include "orbsvcs/Notify/FilterFactory.h" #include "ace/Bound_Ptr.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -19,6 +21,7 @@ TAO_Notify_FilterAdmin::TAO_Notify_FilterAdmin (void) { } + // Implementation skeleton destructor TAO_Notify_FilterAdmin::~TAO_Notify_FilterAdmin (void) { @@ -134,8 +137,14 @@ TAO_Notify_FilterAdmin::save_persistent (TAO_Notify::Topology_Saver& saver) { TAO_Notify::NVPList fattrs; CORBA::Long id = entry->ext_id_; - CORBA::String_var ior = orb->object_to_string(entry->int_id_.in()); - fattrs.push_back(TAO_Notify::NVP("IOR", ior.in())); + + //TBD: this presume the filter always collocated. + //otherwise we need modify the filter interface to add get_filter_id() + + TAO_Notify_FilterFactory* factory = ec_->default_filter_factory_servant (); + TAO_Notify_Object::ID mapid = factory->get_filter_id (entry->int_id_.in ()); + + fattrs.push_back(TAO_Notify::NVP("MapId", mapid)); saver.begin_object(id, "filter", fattrs, changed); saver.end_object(id, "filter"); } @@ -150,15 +159,12 @@ TAO_Notify_FilterAdmin::load_child (const ACE_CString &type, CORBA::Long id, { if (type == "filter") { - TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance(); - CORBA::ORB_var orb = properties->orb(); - ACE_ASSERT(! CORBA::is_nil(orb.in())); - ACE_CString ior; - - (void) attrs.load("IOR", ior); - CORBA::Object_var obj = orb->string_to_object(ior.c_str()); - CosNotifyFilter::Filter_var filter = CosNotifyFilter::Filter::_unchecked_narrow(obj.in()); + TAO_Notify_Object::ID mapid = 0; + attrs.load("MapId", mapid); + TAO_Notify_FilterFactory* factory = ec_->default_filter_factory_servant (); + CosNotifyFilter::Filter_var filter = factory->get_filter (mapid); + if (! CORBA::is_nil(filter.in())) { this->filter_ids_.set_last_used(id); @@ -175,4 +181,11 @@ TAO_Notify_FilterAdmin::release (void) delete this; } +void +TAO_Notify_FilterAdmin::event_channel (TAO_Notify_EventChannel* ec) +{ + this->ec_.reset (ec); +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h index 45114b2879f..77c27c7e2e8 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h @@ -24,6 +24,9 @@ #include "orbsvcs/Notify/Event.h" #include "orbsvcs/Notify/notify_serv_export.h" #include "orbsvcs/Notify/Topology_Object.h" +#include "orbsvcs/Notify/EventChannel.h" + +class TAO_Notify_EventChannel; TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -68,6 +71,9 @@ class TAO_Notify_Serv_Export TAO_Notify_FilterAdmin virtual void save_persistent (TAO_Notify::Topology_Saver& saver); virtual TAO_Notify::Topology_Object* load_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList& attrs); + + void event_channel (TAO_Notify_EventChannel* ec); + private: typedef ACE_Hash_Map_Manager <CosNotifyFilter::FilterID, CosNotifyFilter::Filter_var, ACE_SYNCH_NULL_MUTEX> FILTER_LIST; @@ -81,6 +87,8 @@ class TAO_Notify_Serv_Export TAO_Notify_FilterAdmin /// Id generator for proxy suppliers TAO_Notify_ID_Factory filter_ids_; + + TAO_Notify_EventChannel::Ptr ec_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h b/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h index 1e0b3c56895..7810a37421b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h @@ -23,6 +23,7 @@ #include "ace/Service_Object.h" #include "tao/PortableServer/PortableServer.h" +#include "Topology_Object.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -32,13 +33,19 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * @brief Service Object to obtain a CosNotifyFilter::FilterFactory reference. * */ -class /*TAO_Notify_Serv_Export*/ TAO_Notify_FilterFactory : public ACE_Service_Object +class TAO_Notify_Serv_Export TAO_Notify_FilterFactory + : public ACE_Service_Object, public TAO_Notify::Topology_Object { public: + /// Factory method to create a FilterFactory reference /// The Factory is activated in the default POA. The filters created are activated in the <filter_poa>. virtual CosNotifyFilter::FilterFactory_ptr create ( PortableServer::POA_ptr filter_poa) = 0; + virtual void destroy (void) = 0; + + virtual TAO_Notify_Object::ID get_filter_id (CosNotifyFilter::Filter_ptr filter) = 0; + virtual CosNotifyFilter::Filter_ptr get_filter (const TAO_Notify_Object::ID& id) = 0; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp index 0efb6c66d69..3d9d66c1244 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp @@ -59,11 +59,6 @@ TAO_Notify_Method_Request_Dispatch::TAO_Notify_Method_Request_Dispatch ( TAO_Notify_Method_Request_Dispatch::~TAO_Notify_Method_Request_Dispatch () { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Destroy TAO_Notify_Method_Request_Dispatch @%@\n"), - this)); -#endif } int TAO_Notify_Method_Request_Dispatch::execute_i (void) @@ -79,7 +74,10 @@ int TAO_Notify_Method_Request_Dispatch::execute_i (void) parent.filter_operator ()); if (TAO_debug_level > 1) - ACE_DEBUG ((LM_DEBUG, "Proxysupplier %x filter eval result = %d",&this->proxy_supplier_ , val)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Notify (%P|%t) Proxysupplier %x filter ") + ACE_TEXT ("eval result = %d"), + &this->proxy_supplier_ , val)); // Filter failed - do nothing. if (val == 0) @@ -142,10 +140,11 @@ TAO_Notify_Method_Request_Dispatch::unmarshal ( 0); if (proxy_supplier != 0) { - if (DEBUG_LEVEL > 6) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch reload event for %s\n") - , textpath.c_str() - )); + if (DEBUG_LEVEL > 6) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch") + ACE_TEXT (" reload event for %C\n"), + textpath.c_str())); ACE_NEW_NORETURN (result, TAO_Notify_Method_Request_Dispatch_Queueable (delivery_request, proxy_supplier, true)); } @@ -155,24 +154,24 @@ TAO_Notify_Method_Request_Dispatch::unmarshal ( if (proxy_consumer == 0) { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch::unmarshal: unknown proxy id %s\n") - , textpath.c_str() - )); + ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch") + ACE_TEXT ("::unmarshal: unknown proxy id %C\n"), + textpath.c_str())); } else { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch::unmarshal: wrong type of proxy id %s\n") - , textpath.c_str() - )); + ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch") + ACE_TEXT ("::unmarshal: wrong type of proxy id %C\n"), + textpath.c_str())); } } } else { ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch::unmarshal: Cant read proxy id path\n") - )); + ACE_TEXT ("(%P|%t) TAO_Notify_Method_Request_Dispatch") + ACE_TEXT ("::unmarshal: Cant read proxy id path\n"))); } } return result; @@ -195,11 +194,6 @@ TAO_Notify_Method_Request_Dispatch_Queueable::TAO_Notify_Method_Request_Dispatch , TAO_Notify_Method_Request_Queueable (event.get ()) , event_var_( event ) { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Construct Method_Request_Dispatch @%@\n"), - this)); -#endif } /// Constuct construct from Delivery Request @@ -213,20 +207,10 @@ TAO_Notify_Method_Request_Dispatch_Queueable::TAO_Notify_Method_Request_Dispatch , event_var_( request->event () ) { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Construct unmarshalled Method_Request_Dispatch_Queueable @%@\n"), - this)); -#endif } TAO_Notify_Method_Request_Dispatch_Queueable::~TAO_Notify_Method_Request_Dispatch_Queueable () { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Destroy TAO_Notify_Method_Request_Dispatch_Queueable @%@\n"), - this)); -#endif } int @@ -244,20 +228,10 @@ TAO_Notify_Method_Request_Dispatch_No_Copy::TAO_Notify_Method_Request_Dispatch_N bool filtering) : TAO_Notify_Method_Request_Dispatch (request, request.event (), proxy_supplier, filtering) { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Construct Method_Request_Dispatch_No_Copy @%@\n"), - this)); -#endif } TAO_Notify_Method_Request_Dispatch_No_Copy:: ~TAO_Notify_Method_Request_Dispatch_No_Copy () { -#if 0 - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Destroy Method_Request_Dispatch_No_Copy @%@\n"), - this)); -#endif } int diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp index 1b5b690c459..9159392c8a2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp @@ -2,6 +2,8 @@ #include "orbsvcs/Notify/Notify_Constraint_Interpreter.h" #include "orbsvcs/Notify/Notify_Constraint_Visitors.h" +#include "orbsvcs/Notify/EventType.h" +#include "tao/debug.h" ACE_RCSID (Notify, NS_Constraint_Interpreter, @@ -39,6 +41,79 @@ TAO_Notify_Constraint_Interpreter::build_tree ( } } + +void +TAO_Notify_Constraint_Interpreter::build_tree ( + const CosNotifyFilter::ConstraintExp& exp + ) +{ + ACE_CString exp_str; + ACE_CString et_exp; + + CORBA::ULong len = exp.event_types.length (); + + bool has_et_exp = false; + + for (CORBA::ULong ii = 0; ii < len; ++ii) + { + TAO_Notify_EventType et; + bool d = et.domain_is_wildcard (exp.event_types [ii].domain_name.in ()); + bool t = et.type_is_wildcard (exp.event_types [ii].type_name.in ()); + + if (d && t) + { + exp_str = ""; + break; + } + + if (has_et_exp) + et_exp += " or "; + et_exp += "("; + + has_et_exp = has_et_exp || 1; + + if (! d) + { + et_exp += "$domain_name=='"; + et_exp += exp.event_types [ii].domain_name.in (); + et_exp += "'"; + } + + if (! t) + { + if (!d) + et_exp += " and "; + + et_exp += "$type_name=='"; + et_exp += exp.event_types [ii].type_name.in (); + et_exp += "'"; + } + + et_exp += ")"; + } + + bool valid_constraint = ! ETCL_Interpreter::is_empty_string (exp.constraint_expr.in ()); + + if (has_et_exp && valid_constraint) + { + exp_str = "("; + exp_str += et_exp; + exp_str += ")"; + } + else if (has_et_exp) + exp_str = et_exp; + else if (valid_constraint) + exp_str = exp.constraint_expr.in (); + + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t)Constraint: %C \n"), + exp_str.c_str ())); + } + this->build_tree (exp_str.c_str ()); +} + + CORBA::Boolean TAO_Notify_Constraint_Interpreter::evaluate (TAO_Notify_Constraint_Visitor &evaluator) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h index c9f8af17640..2f644b3b15c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h @@ -51,11 +51,14 @@ public: * Constraint exception if the constraint given has syntax errors or * semantic errors, such as mismatched types. */ - void build_tree (const char* constraints); + void build_tree (const CosNotifyFilter::ConstraintExp& exp); /// Returns true if the constraint is evaluated successfully by /// the evaluator. CORBA::Boolean evaluate (TAO_Notify_Constraint_Visitor &evaluator); + +private: + void build_tree (const char* constraints); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp index 2822defc1db..2cda51d0939 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp @@ -1045,15 +1045,18 @@ TAO_Notify_Constraint_Visitor::visit_binary_op (ETCL_Binary_Expr *binary, this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_LE: - result = left_operand <= right_operand; + // result = left_operand <= right_operand; // Compile error on LynxOS + result = left_operand.operator<= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_GT: - result = left_operand > right_operand; + // result = left_operand > right_operand; // Compile error on LynxOS + result = left_operand.operator> (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_GE: - result = left_operand >= right_operand; + //result = left_operand >= right_operand; // Compile error on LynxOS + result = left_operand.operator>= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_EQ: @@ -1061,7 +1064,8 @@ TAO_Notify_Constraint_Visitor::visit_binary_op (ETCL_Binary_Expr *binary, this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_NE: - result = left_operand != right_operand; + //result = left_operand != right_operand; // Compile error on LynxOS + result = left_operand.operator!= (right_operand); this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result)); break; case ETCL_PLUS: diff --git a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp index d6926c6f8e4..a52eca64945 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp @@ -160,8 +160,11 @@ TAO_Notify_POA_Helper::activate (PortableServer::Servant servant, CORBA::Long& i if (DEBUG_LEVEL > 0) { CORBA::String_var the_name = this->poa_->the_name (); - - ACE_DEBUG ((LM_DEBUG, "Activating object with id = %d in POA : %s\n", id, the_name.in ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) POA_Helper Activating object with ") + ACE_TEXT ("id = %d in POA : %C\n"), + id, the_name.in () + )); } // Convert CORBA::Long to ObjectId @@ -178,7 +181,11 @@ TAO_Notify_POA_Helper::activate_with_id (PortableServer::Servant servant, CORBA: if (DEBUG_LEVEL > 0) { CORBA::String_var the_name = this->poa_->the_name (); - ACE_DEBUG ((LM_DEBUG, "Activating object with existing id = %d in POA : %s\n", id, the_name.in ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) POA_Helper Activating object with ") + ACE_TEXT ("existing id = %d in POA : %C\n"), + id, the_name.in () + )); } this->id_factory_.set_last_used (id); @@ -196,6 +203,14 @@ TAO_Notify_POA_Helper::deactivate (CORBA::Long id) const // Convert CORBA::Long to ObjectId PortableServer::ObjectId_var oid = this->long_to_ObjectId (id); + if (DEBUG_LEVEL > 0) + { + CORBA::String_var the_name = this->poa_->the_name (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) POA_Helper Deactivating object with") + ACE_TEXT ("id = %d in POA : %C\n"), + id, the_name.in ())); + } poa_->deactivate_object (oid.in ()); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp index 6ee5114f3ae..0256a0470b0 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp @@ -21,6 +21,7 @@ TAO_Notify_Properties::TAO_Notify_Properties (void) , dispatching_orb_ (0) , asynch_updates_ (false) , allow_reconnect_ (false) + , validate_client_ (false) , separate_dispatching_orb_ (false) , updates_ (1) , defaultConsumerAdminFilterOp_ (CosNotifyChannelAdmin::OR_OP) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.h b/TAO/orbsvcs/orbsvcs/Notify/Properties.h index 4ace64cc03f..3419780448e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.h @@ -72,6 +72,12 @@ public: bool allow_reconnect (void); void allow_reconnect (bool b); + bool validate_client (void); + void validate_client (bool b); + ACE_Time_Value validate_client_delay (void); + void validate_client_delay (ACE_Time_Value b); + ACE_Time_Value validate_client_interval (void); + void validate_client_interval (ACE_Time_Value b); // Turn on/off update messages. CORBA::Boolean updates (void); @@ -136,6 +142,9 @@ protected: /// True if clients can reconnect to proxies. bool allow_reconnect_; + bool validate_client_; + ACE_Time_Value validate_client_delay_; + ACE_Time_Value validate_client_interval_; /// True is separate dispatching orb bool separate_dispatching_orb_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.inl b/TAO/orbsvcs/orbsvcs/Notify/Properties.inl index 765da34238d..62fb4db7e6b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.inl @@ -89,6 +89,43 @@ TAO_Notify_Properties::allow_reconnect (bool b) } ACE_INLINE bool +TAO_Notify_Properties::validate_client (void) +{ + return this->validate_client_; +} + +ACE_INLINE void +TAO_Notify_Properties::validate_client (bool b) +{ + this->validate_client_ = b; +} + +ACE_INLINE ACE_Time_Value +TAO_Notify_Properties::validate_client_delay (void) +{ + return this->validate_client_delay_; +} + +ACE_INLINE void +TAO_Notify_Properties::validate_client_delay (ACE_Time_Value b) +{ + this->validate_client_delay_ = b; +} + +ACE_INLINE ACE_Time_Value +TAO_Notify_Properties::validate_client_interval (void) +{ + return this->validate_client_interval_; +} + +ACE_INLINE void +TAO_Notify_Properties::validate_client_interval (ACE_Time_Value b) +{ + this->validate_client_interval_ = b; +} + + +ACE_INLINE bool TAO_Notify_Properties::separate_dispatching_orb (void) { return this->separate_dispatching_orb_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h index e310751f31f..79e7aa47285 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h @@ -106,6 +106,8 @@ public: virtual TAO_Notify::Topology_Object* load_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList& attrs); + virtual void validate () = 0; + protected: /// Filter Administration diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp index 742ac748116..34d4c95c72e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp @@ -54,6 +54,8 @@ TAO_Notify_ProxyConsumer::init (TAO_Notify::Topology_Parent* topology_parent) this->supplier_admin_.reset (dynamic_cast<TAO_Notify_SupplierAdmin *>(topology_parent)); ACE_ASSERT (this->supplier_admin_.get() != 0); + this->filter_admin_.event_channel (this->supplier_admin_->event_channel()); + const CosNotification::QoSProperties &default_ps_qos = TAO_Notify_PROPERTIES::instance ()->default_proxy_consumer_qos_properties (); @@ -111,6 +113,8 @@ TAO_Notify_ProxyConsumer::connect (TAO_Notify_Supplier *supplier) void TAO_Notify_ProxyConsumer::push_i (TAO_Notify_Event * event) { + last_ping_ = ACE_OS::gettimeofday (); + if (this->supports_reliable_events ()) { TAO_Notify_Event::Ptr pevent(event->queueable_copy()); @@ -183,4 +187,19 @@ TAO_Notify_ProxyConsumer::destroy (void) // It is not safe to delete the non-refcounted supplier here. } + +ACE_Time_Value +TAO_Notify_ProxyConsumer::last_ping() const +{ + return this->last_ping_.value (); +} + + +void +TAO_Notify_ProxyConsumer::last_ping(const ACE_Time_Value& tv) +{ + this->last_ping_ = tv; +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h index bcb9a45e99b..f191c6d45ac 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h @@ -68,6 +68,9 @@ public: /// The SA parent. TAO_Notify_SupplierAdmin& supplier_admin (void); + ACE_Time_Value last_ping() const; + void last_ping(const ACE_Time_Value& tv); + protected: /// Access the Supplier TAO_Notify_Supplier* supplier (void); @@ -75,6 +78,10 @@ protected: /// Accept an event from the Supplier void push_i (TAO_Notify_Event * event); + /// Last time either push an event or validate connection + /// via _non_exist call. + ACE_Atomic_Op<TAO_SYNCH_MUTEX, ACE_Time_Value> last_ping_; + private: /// Is this part of a reliable channel bool supports_reliable_events () const; @@ -88,6 +95,7 @@ private: /// Access our Peer. virtual TAO_Notify_Peer* peer (void); + }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp index 82de35d8736..309a8dc1dad 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp @@ -37,6 +37,9 @@ TAO_Notify_ProxySupplier::init (TAO_Notify_ConsumerAdmin* consumer_admin) this->consumer_admin_.reset (consumer_admin); + this->filter_admin_.event_channel ( + this->consumer_admin_->event_channel()); + const CosNotification::QoSProperties &default_ps_qos = TAO_Notify_PROPERTIES::instance ()->default_proxy_supplier_qos_properties (); @@ -57,7 +60,7 @@ void TAO_Notify_ProxySupplier::connect (TAO_Notify_Consumer *consumer) { // Adopt the consumer - ACE_Auto_Ptr< TAO_Notify_Consumer > auto_consumer (consumer); + TAO_Notify_Consumer::Ptr auto_consumer (consumer); TAO_Notify_Atomic_Property_Long& consumer_count = this->admin_properties().consumers (); const TAO_Notify_Property_Long& max_consumers = this->admin_properties().max_consumers (); diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h index 8f7d1d7792f..53cede137b9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h @@ -21,6 +21,7 @@ #include "orbsvcs/Notify/Event.h" #include "orbsvcs/Notify/Proxy.h" #include "orbsvcs/Notify/ConsumerAdmin.h" +#include "orbsvcs/Notify/Consumer.h" #include "orbsvcs/CosEventChannelAdminC.h" @@ -85,7 +86,7 @@ private: TAO_Notify_ConsumerAdmin::Ptr consumer_admin_; /// The Consumer that we're connect to. - ACE_Auto_Ptr<TAO_Notify_Consumer> consumer_; + TAO_Notify_Consumer::Ptr consumer_; /// Access our Peer. virtual TAO_Notify_Peer* peer (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp index 1aa065a1b62..23a129e0553 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp @@ -85,6 +85,23 @@ TAO_Notify_SequenceProxyPushConsumer::get_proxy_type_name (void) const } void +TAO_Notify_SequenceProxyPushConsumer::validate () +{ + TAO_Notify_Supplier* sup = this->supplier (); + if (sup != 0 && ! sup->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_SequenceProxyPushConsumer::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_sequence_push_consumer (); + } +} + +void TAO_Notify_SequenceProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h index 937e4ce703f..a20b5fa7c35 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h @@ -52,6 +52,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); protected: ///= Data Members diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp index 95d19c94875..fb2ee51346f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp @@ -62,6 +62,24 @@ TAO_Notify_SequenceProxyPushSupplier::get_proxy_type_name (void) const } void +TAO_Notify_SequenceProxyPushSupplier::validate () +{ + TAO_Notify_Consumer* con = this->consumer (); + if (con != 0 && ! con->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_SequenceProxyPushSupplier::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_sequence_push_supplier (); + } +} + + +void TAO_Notify_SequenceProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h index df868fb85f2..241e6f4eb9b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h @@ -60,6 +60,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); /// = Servant methods virtual CosNotifyChannelAdmin::ProxyType MyType (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp index a63e5274eae..f0e73cac8dc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp @@ -306,7 +306,7 @@ TAO_Notify_SequencePushConsumer::push (const CosNotification::EventBatch& event_ this->push_consumer_->_stubobj()->orb_core()->orbid())); } //--cj end - + last_ping_ = ACE_OS::gettimeofday (); this->push_consumer_->push_structured_events (event_batch); } @@ -336,4 +336,10 @@ TAO_Notify_SequencePushConsumer::reconnect_from_consumer (TAO_Notify_Consumer* o this->schedule_timer(false); } +CORBA::Object_ptr +TAO_Notify_SequencePushConsumer::get_consumer (void) +{ + return CosNotifyComm::SequencePushConsumer::_duplicate (this->push_consumer_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.h index 362cd39b425..3279e6ee66c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.h @@ -78,6 +78,8 @@ public: protected: + virtual CORBA::Object_ptr get_consumer (void); + /// The Consumer CosNotifyComm::SequencePushConsumer_var push_consumer_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp index b4101eb48cf..be8c3139944 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp @@ -50,4 +50,10 @@ TAO_Notify_SequencePushSupplier::get_ior (void) const return result; } +CORBA::Object_ptr +TAO_Notify_SequencePushSupplier::get_supplier (void) +{ + return CosNotifyComm::SequencePushSupplier::_duplicate (this->push_supplier_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h index a944971ffbc..20fc8ea9aac 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h @@ -51,7 +51,10 @@ public: virtual ACE_CString get_ior (void) const; protected: - /// The Supplier + + virtual CORBA::Object_ptr get_supplier (void); + + /// The Supplier CosNotifyComm::SequencePushSupplier_var push_supplier_; }; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp index 8967caff514..ae85ddadb88 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp @@ -81,6 +81,23 @@ TAO_Notify_StructuredProxyPushConsumer::get_proxy_type_name (void) const } void +TAO_Notify_StructuredProxyPushConsumer::validate () +{ + TAO_Notify_Supplier* sup = this->supplier (); + if (sup != 0 && ! sup->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_StructuredProxyPushConsumer::validate(%d)") + ACE_TEXT("disconnecting \n"), this->id ())); + } + + this->disconnect_structured_push_consumer (); + } +} + +void TAO_Notify_StructuredProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h index d4b9d86d331..97d71e73760 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h @@ -52,6 +52,7 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); protected: diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp index faf057ed4b3..e3497094153 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp @@ -65,6 +65,23 @@ TAO_Notify_StructuredProxyPushSupplier::get_proxy_type_name (void) const } void +TAO_Notify_StructuredProxyPushSupplier::validate () +{ + TAO_Notify_Consumer* con = this->consumer (); + if (con != 0 && ! con->is_alive (true)) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) TAO_Notify_StructuredProxyPushSupplier::validate(%d)") + ACE_TEXT ("disconnecting \n"), this->id ())); + } + + this->disconnect_structured_push_supplier (); + } +} + +void TAO_Notify_StructuredProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs) { SuperClass::load_attrs(attrs); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h index 9a5f64ea3e2..920318640c2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h @@ -59,6 +59,7 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); + virtual void validate (); /// = Servant methods // = interface methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp index a82191d88dc..efea0f8111c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp @@ -107,6 +107,8 @@ TAO_Notify_StructuredPushConsumer::push (const CORBA::Any& event) connection_valid = 1; } + last_ping_ = ACE_OS::gettimeofday (); + this->push_consumer_->push_structured_event (notification); } @@ -138,6 +140,8 @@ TAO_Notify_StructuredPushConsumer::push (const CosNotification::StructuredEvent& connection_valid = 1; } + last_ping_ = ACE_OS::gettimeofday (); + this->push_consumer_->push_structured_event (event); } @@ -176,4 +180,10 @@ TAO_Notify_StructuredPushConsumer::get_ior (void) const return result; } +CORBA::Object_ptr +TAO_Notify_StructuredPushConsumer::get_consumer (void) +{ + return CosNotifyComm::StructuredPushConsumer::_duplicate (this->push_consumer_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h index c169a4678c2..a7cd9f05d87 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h @@ -66,6 +66,9 @@ public: protected: + + virtual CORBA::Object_ptr get_consumer (void); + /// The Consumer CosNotifyComm::StructuredPushConsumer_var push_consumer_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp index 7c98e79ef6e..09619c5b83f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp @@ -49,4 +49,10 @@ TAO_Notify_StructuredPushSupplier::get_ior (void) const return result; } +CORBA::Object_ptr +TAO_Notify_StructuredPushSupplier::get_supplier (void) +{ + return CosNotifyComm::StructuredPushSupplier::_duplicate (this->push_supplier_.in ()); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h index 33114c5c309..d4b8d62f7b1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h @@ -48,6 +48,9 @@ public: virtual ACE_CString get_ior (void) const; protected: + + virtual CORBA::Object_ptr get_supplier (void); + /// The Supplier CosNotifyComm::StructuredPushSupplier_var push_supplier_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp index d760d336730..e4cde846df6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp @@ -1,6 +1,11 @@ // $Id$ +#include "tao/corba.h" +#include "orbsvcs/Time_Utilities.h" +#include "orbsvcs/Notify/Properties.h" #include "orbsvcs/Notify/Supplier.h" +#include "tao/debug.h" +#include "tao/Messaging/Messaging_TypesC.h" #if ! defined (__ACE_INLINE__) #include "orbsvcs/Notify/Supplier.inl" @@ -11,6 +16,10 @@ ACE_RCSID(Notify, TAO_Notify_Supplier, "$Id$") #include "orbsvcs/Notify/ProxyConsumer.h" #include "orbsvcs/Notify/Proxy.h" +#ifndef DEBUG_LEVEL +# define DEBUG_LEVEL TAO_debug_level +#endif //DEBUG_LEVEL + TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_Supplier::TAO_Notify_Supplier (TAO_Notify_ProxyConsumer* proxy) @@ -37,4 +46,89 @@ TAO_Notify_Supplier::dispatch_updates_i ( this->subscribe_->subscription_change (added, removed); } + + +bool +TAO_Notify_Supplier::is_alive (bool allow_nil_supplier) +{ + bool status = false; + CORBA::Object_var supplier = this->get_supplier (); + if (CORBA::is_nil (supplier.in ())) + { + // The supplier may not connected or the supplier did + // not provide a callback. In this case, the liveliness + // check should return true so it will be validated in + // next period. + if (allow_nil_supplier) + return true; + else + return status; + } + + CORBA::PolicyList policy_list; + try + { + bool do_liveliness_check = false; + ACE_Time_Value now = ACE_OS::gettimeofday (); + ACE_Time_Value last_ping = proxy_->last_ping(); + if (CORBA::is_nil (this->rtt_obj_.in ())) + { + // We need to determine if the supplier on the other end is still + // alive. Since we may be in an upcall from the owner of the + // original supplier, we have to put a timeout on the call in case + // the client side is not processing ORB requests at this time. In + // the event that the timeout exception occurs, we will assume that + // the original supplier is still around. If we get any other + // exception we will say that the original supplier is not + // available anymore. + TimeBase::TimeT timeout = 10000000; + CORBA::Any timeout_any; + timeout_any <<= timeout; + + policy_list.length (1); + policy_list[0] = TAO_Notify_PROPERTIES::instance()->orb()-> + create_policy ( + Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, + timeout_any); + rtt_obj_ = + supplier->_set_policy_overrides (policy_list, + CORBA::ADD_OVERRIDE); + + // Clean up the policy that was allocated in the try/catch + for (CORBA::ULong i = 0; i < policy_list.length (); i++) + policy_list[i]->destroy (); + + do_liveliness_check + = (last_ping == ACE_Time_Value::zero ? true + : now - last_ping >= TAO_Notify_PROPERTIES::instance()->validate_client_delay ()); + } + else + do_liveliness_check = + now - last_ping >= TAO_Notify_PROPERTIES::instance()->validate_client_interval (); + + if (CORBA::is_nil (rtt_obj_.in ())) + status = false; + else if (do_liveliness_check || allow_nil_supplier) + { + this->proxy_->last_ping (now); + status = !rtt_obj_->_non_existent (); + } + else + status = true; + } + catch (CORBA::TIMEOUT&) + { + status = true; + } + catch (CORBA::Exception& ex) + { + if (DEBUG_LEVEL > 0) + { + ex._tao_print_exception ("TAO_Notify_Supplier::is_alive: false"); + } + } + + return status; +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.h b/TAO/orbsvcs/orbsvcs/Notify/Supplier.h index e040215e6cf..8ed6141d295 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Supplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.h @@ -47,7 +47,12 @@ public: /// Access Base Proxy. virtual TAO_Notify_Proxy* proxy (void); + virtual CORBA::Object_ptr get_supplier (void) = 0; + + bool is_alive (bool allow_nil_supplier); + protected: + /// Dispatch updates implementation. virtual void dispatch_updates_i (const CosNotification::EventTypeSeq& added, const CosNotification::EventTypeSeq& removed); @@ -57,6 +62,8 @@ protected: /// Interface that accepts subscription_changes CosNotifyComm::NotifySubscribe_var subscribe_; + + CORBA::Object_var rtt_obj_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp index 5bd5aab1bb7..2adb7572771 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp @@ -87,16 +87,16 @@ TAO_Notify_ThreadPool_Task::init (const NotifyExt::ThreadPoolParams& tp_params, this->_decr_refcnt(); } - if (TAO_debug_level > 0) + if (ACE_OS::last_error () == EPERM) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Insufficient privilege.\n"))); + else if (ACE_OS::last_error () == EAGAIN) { - if (ACE_OS::last_error () == EPERM) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Insufficient privilege.\n"))); - else - ACE_DEBUG ((LM_ERROR, - ACE_TEXT ("(%t) task activation at priority %d failed\n") - ACE_TEXT ("exiting!\n%a"), - tp_params.default_priority)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) task activation at priority %d failed %p\n"), + tp_params.default_priority, "activate")); + throw CORBA::NO_RESOURCES (); } + throw CORBA::BAD_PARAM (); } } @@ -151,7 +151,7 @@ TAO_Notify_ThreadPool_Task::svc (void) else { if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "ThreadPool_Task dequeue failed\n")); + ACE_DEBUG ((LM_DEBUG, "(%P|%t)ThreadPool_Task dequeue failed\n")); } } catch (const CORBA::Exception& ex) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.cpp new file mode 100644 index 00000000000..5d76943f6cf --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.cpp @@ -0,0 +1,88 @@ +/* -*- C++ -*- $Id$ */ +#include "Validate_Client_Task.h" + +ACE_RCSID(Notify, Validate_Client_Task, "$Id$") + +#include "EventChannelFactory.h" +#include "tao/ORB_Core.h" +#include "tao/debug.h" +#include "ace/Reactor.h" + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO_Notify_validate_client_Task:: + TAO_Notify_validate_client_Task (const ACE_Time_Value &delay, + const ACE_Time_Value &interval, + TAO_Notify_EventChannelFactory *ecf) + : delay_ (delay), + interval_ (interval), + ecf_ (ecf), + shutdown_ (false) +{ + if (this->activate (THR_NEW_LWP | THR_JOINABLE, 1) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT("(%P|%t)TAO_Notify_validate_client_Task: %p\n"),"activate")); + } +} + + +TAO_Notify_validate_client_Task::~TAO_Notify_validate_client_Task (void) +{ +} + + +int +TAO_Notify_validate_client_Task::svc (void) +{ + ACE_Time_Value due = ACE_OS::gettimeofday () + this->delay_; + while (! this->shutdown_) + { + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, *(this->condition_.mutex()), -1); + this->condition_.wait (&due); + } + + if (this->shutdown_) + break; + + try + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P|%t)%T TAO_Notify_validate_client_Task::svc validate start\n"))); + } + this->ecf_->validate (); + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P|%t)%T TAO_Notify_validate_client_Task::svc validate end\n"))); + } + } + catch (...) + { + // Ignore all exceptions + } + + if (this->interval_ == ACE_Time_Value::zero) + break; + + due = ACE_OS::gettimeofday () + this->interval_; + } + + return 0; +} + + +void +TAO_Notify_validate_client_Task::shutdown (void) +{ + { + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, *(this->condition_.mutex())); + this->shutdown_ = true; + this->condition_.signal (); + } + this->wait (); +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.h b/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.h new file mode 100644 index 00000000000..63ea04584dd --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Validate_Client_Task.h @@ -0,0 +1,84 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Validate_Client_Task.h + * + * $Id$ + * + * @author Yan Dai (dai_y@ociweb.com) + */ +//============================================================================= + +#ifndef NOTIFY_VALIDATE_CLIENT_TASK_H +#define NOTIFY_VALIDATE_CLIENT_TASK_H + +#include /**/ "ace/pre.h" + +#include "notify_serv_export.h" + +#include "tao/ORB.h" +#include "tao/Condition.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_Notify_EventChannelFactory; + + +/** + * @class TAO_Notify_validate_client_Task + * + * @brief ClientControl + * + * Defines the interface for the consumer control strategy. + * This strategy handles misbehaving or failing consumers. + * = MEMORY MANAGMENT + * = LOCKING + * = TODO + */ +class TAO_Notify_Serv_Export TAO_Notify_validate_client_Task + : public ACE_Task<ACE_NULL_SYNCH> +{ +public: + + typedef TAO_Condition<TAO_SYNCH_MUTEX> CONDITION; + + /// Constructor. It does not assume ownership of the <event_channel> + /// parameter. + TAO_Notify_validate_client_Task (const ACE_Time_Value &delay, + const ACE_Time_Value &interval, + TAO_Notify_EventChannelFactory *ecf); + + /// destructor... + virtual ~TAO_Notify_validate_client_Task (void); + + virtual int svc (void); + + void shutdown (void); + +private: + /// The delay of first time validate. + ACE_Time_Value delay_; + + /// The validate interval + ACE_Time_Value interval_; + + /// The event channel + TAO_Notify_EventChannelFactory *ecf_; + + CONDITION condition_; + + bool shutdown_; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* NOTIFY_VALIDATE_CLIENT_TASK_H */ + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.cpp new file mode 100644 index 00000000000..0b048d75502 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.cpp @@ -0,0 +1,45 @@ +/* -*- C++ -*- $Id$ */ + +#ifndef NOTIFY_VALIDATE_WORKER_CPP +#define NOTIFY_VALIDATE_WORKER_CPP + +#include "Validate_Worker_T.h" +#include "tao/debug.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO_Notify +{ + template<class TOPOOBJ> + Validate_Worker<TOPOOBJ>::Validate_Worker() + { + } + + template<class TOPOOBJ> + void + Validate_Worker<TOPOOBJ>::work (TOPOOBJ* o) + { + if (o == 0) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t)Validate_Worker<TOPOOBJ>::work: obj is nil\n"))); + } + } + else + { + o->validate (); + } + } +} // namespace TAO_Notify + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif /* VALIDATE_WORKER_CPP */ + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.h b/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.h new file mode 100644 index 00000000000..e4e13647acf --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Validate_Worker_T.h @@ -0,0 +1,56 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Validate_Worker_T.h + * + * $Id$ + * + * @author Yan Dai (dai_y@ociweb.com) + */ +//============================================================================= + +#ifndef NOTIFY_VALIDATE_WORKER_H +#define NOTIFY_VALIDATE_WORKER_H + +#include /**/ "ace/pre.h" + +#include "orbsvcs/ESF/ESF_Worker.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO_Notify +{ + /** + * \brief Iterate through children reconnecting after reloading persistent information. + */ + template<class TOPOOBJ> + class Validate_Worker : public TAO_ESF_Worker<TOPOOBJ> + { + public: + /// Constructor + Validate_Worker(); + + // override virtual ESF_Worker method + virtual void work (TOPOOBJ* o); + }; +} // namespace TAO_Notify + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Validate_Worker_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Validate_Worker_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* NOTIFY_VALIDATE_WORKER_H */ + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/XML_Saver.cpp b/TAO/orbsvcs/orbsvcs/Notify/XML_Saver.cpp index 5b7be5a138e..90b3b415903 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/XML_Saver.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/XML_Saver.cpp @@ -177,10 +177,11 @@ namespace TAO_Notify ACE_TString tmp(BUF_SIZE); for (size_t idx = 0; idx < attrs.size(); ++idx) { - ACE_TString valuetmp (ACE_TEXT_CHAR_TO_TCHAR(attrs[idx].value.c_str())); + ACE_TString valuetmp (ACE_TEXT_CHAR_TO_TCHAR (attrs[idx].value.c_str())); ACEXML_escape_string(valuetmp, tmp); - ACE_OS::fprintf (out, "%s%s%s%s%s", " ", - attrs[idx].name.c_str (), "=\"", tmp.c_str(), "\""); + ACE_OS::fprintf (out, "%s%s%s%s%s"," ", + attrs[idx].name.c_str (), + "=\"", ACE_TEXT_ALWAYS_CHAR (tmp.c_str()), "\""); } ACE_OS::fprintf (out, ">\n"); this->indent_ += " "; diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h index 07185f531f1..0bdde1c0a35 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.h @@ -151,7 +151,7 @@ namespace TAO * handshake. This includes both the TCP handshake and the SSL * handshake. */ - const ACE_Time_Value timeout_; + ACE_Time_Value const timeout_; }; diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.inl b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.inl index 0233a73fc01..f52a511c417 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.inl +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_OpenSSL_st_T.inl @@ -2,6 +2,8 @@ // // $Id$ +// This is needed on LynxOS 4.0 with GCC 2.95 +#include "ace/OS_NS_stdio.h" #include <openssl/crypto.h> diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp index 7da5f41f889..acee802653c 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp @@ -169,50 +169,17 @@ TAO::SSLIOP::Transport::send_message (TAO_OutputCDR &stream, return 1; } - -int -TAO::SSLIOP::Transport::generate_request_header ( - TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg) -{ - // Check whether we have a Bi Dir IIOP policy set, whether the - // messaging objects are ready to handle bidirectional connections - // and also make sure that we have not recd. or sent any information - // regarding this before... - if (this->orb_core ()->bidir_giop_policy () - && this->messaging_object ()->is_ready_for_bidirectional (msg) - && this->bidirectional_flag () < 0) - { - this->set_bidir_context_info (opdetails); - - // Set the flag to 1 - this->bidirectional_flag (1); - - // At the moment we enable BiDIR giop we have to get a new - // request id to make sure that we follow the even/odd rule - // for request id's. We only need to do this when enabled - // it, after that the Transport Mux Strategy will make sure - // that the rule is followed - opdetails.request_id (this->tms ()->request_id ()); - } - - // We are going to pass on this request to the underlying messaging - // layer. It should take care of this request - return TAO_Transport::generate_request_header (opdetails, spec, msg); -} - int TAO::SSLIOP::Transport::tear_listen_point_list (TAO_InputCDR &cdr) { CORBA::Boolean byte_order; - if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) + if (!(cdr >> ACE_InputCDR::to_boolean (byte_order))) return -1; cdr.reset_byte_order (static_cast<int> (byte_order)); IIOP::ListenPointList listen_list; - if ((cdr >> listen_list) == 0) + if (!(cdr >> listen_list)) return -1; // As we have received a bidirectional information, set the flag to @@ -242,7 +209,7 @@ TAO::SSLIOP::Transport::set_bidir_context_info ( acceptor++) { // Check whether it is a IIOP acceptor - if ((*acceptor)->tag () == IOP::TAG_INTERNET_IOP) + if ((*acceptor)->tag () == this->tag ()) { if (this->get_listen_point (listen_point_list, *acceptor) == -1) { @@ -259,8 +226,8 @@ TAO::SSLIOP::Transport::set_bidir_context_info ( TAO_OutputCDR cdr; // Marshall the information into the stream - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) - || (cdr << listen_point_list) == 0) + if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) + || !(cdr << listen_point_list)) return; // Add this info in to the svc_list diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h index 88a76ed8546..6d32bec493e 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h @@ -111,10 +111,6 @@ namespace TAO TAO_TWOWAY_REQUEST, ACE_Time_Value *max_time_wait = 0); - virtual int generate_request_header (TAO_Operation_Details &opdetails, - TAO_Target_Specification &spec, - TAO_OutputCDR &msg); - /// Open teh service context list and process it. virtual int tear_listen_point_list (TAO_InputCDR &cdr); //@} diff --git a/TAO/orbsvcs/orbsvcs/Sched/Scheduler.cpp b/TAO/orbsvcs/orbsvcs/Sched/Scheduler.cpp index 79234617c6f..42973f57074 100644 --- a/TAO/orbsvcs/orbsvcs/Sched/Scheduler.cpp +++ b/TAO/orbsvcs/orbsvcs/Sched/Scheduler.cpp @@ -153,7 +153,7 @@ ACE_Scheduler::get_rt_info (Object_Name name, if (info_collection_.bind (lookup, info_array) != 0) { delete rtinfo; - delete info_array; + delete [] info_array; rtinfo = 0; return FAILED; // Error! } |