summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Totten <tottens@users.noreply.github.com>2003-10-10 19:06:45 +0000
committerSteve Totten <tottens@users.noreply.github.com>2003-10-10 19:06:45 +0000
commite1c0c9da0fdf9e52606918e597b2d7a2d7ec08fc (patch)
tree8f09dec9c8ac35eecccae2e84f55ab54f02b0223
parent25da55b4b6b9aaefd2cc7c05d292d2975d7a9605 (diff)
downloadATCD-e1c0c9da0fdf9e52606918e597b2d7a2d7ec08fc.tar.gz
ChangeLogTag: Fri Oct 10 13:58:04 2003 Steve Totten <totten_s@ociweb.com>
-rw-r--r--TAO/ChangeLog86
-rwxr-xr-xTAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.cpp297
-rwxr-xr-xTAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h35
-rwxr-xr-xTAO/orbsvcs/FT_ReplicationManager/FT_FaultEventDescriptor.h6
-rw-r--r--TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp109
-rw-r--r--TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h48
-rw-r--r--TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp11
-rw-r--r--TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp2
-rw-r--r--TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp59
-rw-r--r--TAO/orbsvcs/tests/FT_App/FT_UnitTests.h8
-rwxr-xr-xTAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp2
-rwxr-xr-xTAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.h5
12 files changed, 518 insertions, 150 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 45134529d95..0f183cc7976 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,22 @@
+Fri Oct 10 13:58:04 2003 Steve Totten <totten_s@ociweb.com>
+
+ * orbsvcs/FT_ReplicationManager/FT_FaultConsumer.cpp:
+ * orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h:
+ * orbsvcs/FT_ReplicationManager/FT_FaultEventDescriptor.h:
+ Added more fault analysis logic.
+
+ * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp:
+ * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h:
+ * orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp:
+ Updated to conform to ACE guidelines and new Server_Main.
+ Still in progress.
+
+ * orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp:
+ * orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.h:
+ Minor code cleanup.
+
+ These changes were made in the oci_haft branch.
+
Fri Oct 10 12:09:39 2003 Dale Wilson <wilson_d@ociweb.com>
* orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.h:
@@ -62,6 +81,70 @@ Fri Oct 10 12:09:39 2003 Dale Wilson <wilson_d@ociweb.com>
These changes were made in the oci_haft branch.
+Thu Oct 9 14:26:48 2003 Steve Totten <totten_s@ociweb.com>
+
+ * orbsvcs/orbsvcs/PortableGroup.idl:
+ Added a TAO-specific get_object_group_ref_from_id()
+ operation to PortableGroup::ObjectGroupManager.
+ This operation will be needed by the FT_ReplicationManager
+ to lookup the ObjectGroup reference from the ObjectGroupId
+ that it receives in a fault report. This operation may
+ be generally useful to other services, as well.
+
+ Also changed TagGroupTaggedComponent member
+ "component_version" to "group_version" to match the
+ following specs:
+ - Load Balancing joint submission (mars/02-10-14)
+ - Unreliabe Multicast final adopted spec (ptc/01-11-08)
+ - Data Parallel CORBA final adopted spec (ptc/01-11-09)
+
+ * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp:
+ * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h:
+ * orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp:
+ * orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h:
+ Added implementation of TAO-specific
+ get_object_group_ref_from_id() operation that delegates to
+ the underlying PortableGroup ObjectGroupManager
+ implementation.
+
+ * orbsvcs/orbsvcs/FaultTolerance/FT_IOGR_Property.cpp:
+ Use "group_version" instead of "component_version".
+
+ * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp:
+ * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h:
+ Implemented TAO-specific get_object_group_ref_from_id()
+ operation.
+ Also, changed "component_version" to "group_version".
+
+ * orbsvcs/orbsvcs/PortableGroup/PG_Utils.cpp:
+ * orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.cpp:
+ * orbsvcs/tests/FaultTolerance/IOGRManipulation/IOGRTest.cpp:
+ Changed "component_version" to "group_version".
+
+ * orbsvcs/tests/FaultTolerance/IOGR/FaultTolerance_IOGR.mpc:
+ Added portablegroup and Messaging base projects.
+
+ * orbsvcs/tests/FaultTolerance/IOGR/Manager.cpp:
+ Changed "version" to "group_version" and "ft_domain_id" to
+ "group_domain_id" to match names of members of
+ PortableGroup::TagGroupTaggedComponent IDL struct.
+
+ These changes were made in the oci_haft branch.
+
+Thu Oct 9 14:24:47 2003 Steve Totten <totten_s@ociweb.com>
+
+ Applied the following changes on behalf of
+ Curt Hibbs <hibbs_c@ociweb.com>:
+
+ * orbsvcs/tests/FT_App/FT_UnitTests.cpp:
+ * orbsvcs/tests/FT_App/FT_UnitTests.h:
+ Made changes to use FT_ReplicaFactory to populate the FactoryInfos
+ for unit testing.
+
+ * orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp:
+ Fixed a bug in validating properties when creating groups.
+
+ These changes were made in the oci_haft branch.
Wed Oct 8 13:59:40 2003 Steve Totten <totten_s@ociweb.com>
@@ -151,7 +234,6 @@ Tues Oct 7 08:44:52 2003 Dale Wilson <wilson_d@ociweb.com>
Respond to style issues raised during code review and Bala's @@ notes.
Fix shutdown race condition that caused unit test failures.
-
* orbsvcs/tests/FT_App/run_test_notifier.pl:
Reduce the timeouts for processes that we "know" will be gone.
It makes the test fail faster when something goes wrong.
@@ -162,7 +244,6 @@ Tues Oct 7 08:44:52 2003 Dale Wilson <wilson_d@ociweb.com>
These changes were made in the oci_haft branch.
-
Mon Oct 6 17:18:30 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
* orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.cpp:
@@ -300,7 +381,6 @@ Mon Sep 29 18:55:08 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
Mon Sep 29 18:39:05 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-
A temporary hack for Boris to keep progressing. The aim of this
hack in the branch is to add a propreietary interception
point. This is what this checkin is all about
diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.cpp
index 3662e73ea01..22d323e2388 100755
--- a/TAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.cpp
+++ b/TAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.cpp
@@ -18,6 +18,7 @@
#include "orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h"
#include "orbsvcs/FT_ReplicationManagerC.h"
+#include "orbsvcs/PortableGroup/PG_Property_Utils.h"
#include <tao/debug.h>
ACE_RCSID (FT_FaultConsumer,
@@ -170,7 +171,6 @@ void TAO::FT_FaultConsumer::push_structured_event (
if (result == 0)
{
result = this->validate_event_type (event);
- ACE_CHECK;
if (result != 0)
{
ACE_ERROR ((LM_ERROR,
@@ -185,19 +185,35 @@ void TAO::FT_FaultConsumer::push_structured_event (
if (result == 0)
{
TAO::FT_FaultEventDescriptor fault_event_desc;
- result = this->analyze_fault_event (
- event,
- fault_event_desc
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
- if (result != 0)
+
+ // Make sure we catch and swallow any CORBA exceptions locally
+ // so they do not propagate back to the Fault Notifier.
+ ACE_TRY_NEW_ENV
{
- ACE_ERROR ((LM_ERROR,
+ result = this->analyze_fault_event (
+ event,
+ fault_event_desc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ if (result != 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::push_structured_event: "
+ "Could not analyze fault event.\n")
+ ));
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
ACE_TEXT (
"TAO::FT_FaultConsumer::push_structured_event: "
"Could not analyze fault event.\n")
- ));
+ );
}
+ ACE_CHECK_RETURN (-1);
+ ACE_ENDTRY;
// Debugging support.
#if (TAO_DEBUG_LEVEL_NEEDED == 1)
@@ -484,28 +500,119 @@ int TAO::FT_FaultConsumer::analyze_fault_event (
// property and MembershipStyle of the object group is FT::MEMB_INF_CTRL,
// create and add a new member.
- //Q: How do we get the ObjectGroup from the ObjectGroupId?
- //A: ??
-
- //Q: Then, how do we get the properties of the ObjectGroup to
- // figure out the ReplicationStyle, current primary,
- // MinimumNumberReplicas, etc.?
- //A: FT::PropertyManager::get_properties().
+ //@@ Q: How do we get the ObjectGroup from the ObjectGroupId?
+ //@@ A: Use TAO-specific extension to PortableGroup::ObjectGroupManager
+ // interface (get_object_group_ref_from_id()).
+#if (INTEGRATED_WITH_REPLICATION_MANAGER == 1)
+ if ((fault_event_desc.object_at_location_failed == 1) && (result == 0))
+ {
+ FT::ObjectGroup_var the_object_group =
+ this->replication_manager_->get_object_group_ref_from_id (
+ fault_event_desc.object_group_id
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ if (CORBA::is_nil (the_object_group.in()))
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "Could not get ObjectGroup reference from ObjectGroupId: <%Q>.\n"),
+ fault_event_desc.object_group_id
+ ));
+ result = -1;
+ }
- // Assuming we have the ObjectGroup reference...
- FT::ObjectGroup_var the_object_group;
+ //@@ Q: How do we get the properties of the ObjectGroup to
+ // figure out the ReplicationStyle, current primary,
+ // MinimumNumberReplicas, etc.?
+ //@@ A: FT::PropertyManager::get_properties().
- // Get the properties associated with this ObjectGroup.
-#if 0
- if (result == 0)
- {
- FT::Properties_var properties =
- this->replication_manager_->get_properties (
+ // Get the properties associated with this ObjectGroup.
+ FT::Properties_var properties;
+ if (result == 0)
+ {
+ properties = this->replication_manager_->get_properties (
the_object_group.in()
ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
+ ACE_CHECK_RETURN (-1);
+
+ // Get the MembershipStyle property.
+ FT::MembershipStyleValue membership_style;
+ result = this->get_membership_style (properties.in(), membership_style);
+ if (result != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "Could not extract MembershipStyle from properties on "
+ "ObjectGroup with id <%Q>.\n"),
+ fault_event_desc.object_group_id),
+ -1);
+ }
+ else
+ {
+ fault_event_desc.membership_style = membership_style;
+ }
+
+ // Get the ReplicationStyle property.
+ FT::ReplicationStyleValue replication_style;
+ result = this->get_replication_style (properties.in(), replication_style);
+ if (result != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "Could not extract ReplicationStyle from properties on "
+ "ObjectGroup with id <%Q>.\n"),
+ fault_event_desc.object_group_id),
+ -1);
+ }
+ else
+ {
+ fault_event_desc.replication_style = replication_style;
+ }
+
+ // Get the MinimumNumberReplicas property.
+ FT::MinimumNumberReplicasValue minimum_number_replicas;
+ result = this->get_minimum_number_replicas (
+ properties.in(), minimum_number_replicas);
+ if (result != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "Could not extract MinimumNumberReplicas from properties on "
+ "ObjectGroup with id <%Q>.\n"),
+ fault_event_desc.object_group_id),
+ -1);
+ }
+ else
+ {
+ fault_event_desc.minimum_number_replicas = minimum_number_replicas;
+ }
+
+ // Get the InitialNumberReplicas property.
+ FT::InitialNumberReplicasValue initial_number_replicas;
+ result = this->get_initial_number_replicas (
+ properties.in(), initial_number_replicas);
+ if (result != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "Could not extract InitialNumberReplicas from properties on "
+ "ObjectGroup with id <%Q>.\n"),
+ fault_event_desc.object_group_id),
+ -1);
+ }
+ else
+ {
+ fault_event_desc.initial_number_replicas = initial_number_replicas;
+ }
+
+ }
}
-#endif
+#endif /* (INTEGRATED_WITH_REPLICATION_MANAGER == 1) */
return result;
}
@@ -546,3 +653,141 @@ TAO::FT_FaultConsumer::extract_object_group_id (const CORBA::Any& val)
return id;
}
+//
+//TODO: Use TAO_PG::find() to get property values from properties
+// instead of all these specific "get" functions.
+//
+
+// Get the MembershipStyle property.
+int TAO::FT_FaultConsumer::get_membership_style (
+ const FT::Properties & properties,
+ FT::MembershipStyleValue & membership_style)
+{
+ FT::Name prop_name (1);
+ prop_name.length (1);
+ prop_name[0].id = CORBA::string_dup (FT::FT_MEMBERSHIP_STYLE);
+ int result = 0;
+
+ FT::Value value;
+ if (TAO_PG::get_property_value (prop_name, properties, value)
+ && ((value >>= membership_style) == 1))
+ {
+#if (TAO_DEBUG_LEVEL_NEEDED == 1)
+ if (TAO_debug_level > 6)
+#endif /* (TAO_DEBUG_LEVEL_NEEDED == 1) */
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "MembershipStyle is <%d>:\n"),
+ membership_style
+ ));
+ }
+ }
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+}
+
+int TAO::FT_FaultConsumer::get_replication_style (
+ const FT::Properties & properties,
+ FT::ReplicationStyleValue & replication_style)
+{
+ FT::Name prop_name (1);
+ prop_name.length (1);
+ prop_name[0].id = CORBA::string_dup (FT::FT_REPLICATION_STYLE);
+ int result = 0;
+
+ FT::Value value;
+ if (TAO_PG::get_property_value (prop_name, properties, value)
+ && ((value >>= replication_style) == 1))
+ {
+#if (TAO_DEBUG_LEVEL_NEEDED == 1)
+ if (TAO_debug_level > 6)
+#endif /* (TAO_DEBUG_LEVEL_NEEDED == 1) */
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "ReplicationStyle is <%d>:\n"),
+ replication_style
+ ));
+ }
+ }
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+}
+
+int TAO::FT_FaultConsumer::get_minimum_number_replicas (
+ const FT::Properties & properties,
+ FT::MinimumNumberReplicasValue & minimum_number_replicas)
+{
+ FT::Name prop_name (1);
+ prop_name.length (1);
+ prop_name[0].id = CORBA::string_dup (FT::FT_MINIMUM_NUMBER_REPLICAS);
+ int result = 0;
+
+ FT::Value value;
+ if (TAO_PG::get_property_value (prop_name, properties, value)
+ && ((value >>= minimum_number_replicas) == 1))
+ {
+#if (TAO_DEBUG_LEVEL_NEEDED == 1)
+ if (TAO_debug_level > 6)
+#endif /* (TAO_DEBUG_LEVEL_NEEDED == 1) */
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "MinimumNumberReplicas is <%d>:\n"),
+ minimum_number_replicas
+ ));
+ }
+ }
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+}
+
+int TAO::FT_FaultConsumer::get_initial_number_replicas (
+ const FT::Properties & properties,
+ FT::InitialNumberReplicasValue & initial_number_replicas)
+{
+ FT::Name prop_name (1);
+ prop_name.length (1);
+ prop_name[0].id = CORBA::string_dup (FT::FT_INITIAL_NUMBER_REPLICAS);
+ int result = 0;
+
+ FT::Value value;
+ if (TAO_PG::get_property_value (prop_name, properties, value)
+ && ((value >>= initial_number_replicas) == 1))
+ {
+#if (TAO_DEBUG_LEVEL_NEEDED == 1)
+ if (TAO_debug_level > 6)
+#endif /* (TAO_DEBUG_LEVEL_NEEDED == 1) */
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT (
+ "TAO::FT_FaultConsumer::analyze_fault_event: "
+ "InitialNumberReplicas is <%d>:\n"),
+ initial_number_replicas
+ ));
+ }
+ }
+ else
+ {
+ result = -1;
+ }
+
+ return result;
+}
+
diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h b/TAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h
index 82f82a8d090..b00702b18ea 100755
--- a/TAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h
+++ b/TAO/orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h
@@ -111,30 +111,21 @@ namespace TAO
char* extract_type_id (const CORBA::Any& val);
FT::ObjectGroupId extract_object_group_id (const CORBA::Any& val);
- /**
- * Set a new primary member on an object group.
- */
- int set_new_primary_on_object_group (
- FT::ObjectGroup_ptr object_group,
- const FT::Location & the_location
- ACE_ENV_ARG_DECL_WITH_DEFAULTS
- )
- ACE_THROW_SPEC ((
- CORBA::SystemException
- , PortableGroup::ObjectGroupNotFound
- , PortableGroup::MemberNotFound
- , FT::PrimaryNotSet
- , FT::BadReplicationStyle
- ));
+ int get_membership_style (
+ const FT::Properties & properties,
+ FT::MembershipStyleValue & membership_style);
+
+ int get_replication_style (
+ const FT::Properties & properties,
+ FT::ReplicationStyleValue & replication_style);
- /**
- * Extract the value of the MinimumNumberReplicas property from
- * the_criteria.
- */
int get_minimum_number_replicas (
- const char * type_id,
- const PortableGroup::Criteria & the_criteria,
- CORBA::UShort & minimum_number_replicas);
+ const FT::Properties & properties,
+ FT::MinimumNumberReplicasValue & minimum_number_replicas);
+
+ int get_initial_number_replicas (
+ const FT::Properties & properties,
+ FT::InitialNumberReplicasValue & initial_number_replicas);
public:
diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_FaultEventDescriptor.h b/TAO/orbsvcs/FT_ReplicationManager/FT_FaultEventDescriptor.h
index 735491b81e7..a012de9e42f 100755
--- a/TAO/orbsvcs/FT_ReplicationManager/FT_FaultEventDescriptor.h
+++ b/TAO/orbsvcs/FT_ReplicationManager/FT_FaultEventDescriptor.h
@@ -52,6 +52,12 @@ namespace TAO
/// The ObjectGroupId of the faulted object.
PortableGroup::ObjectGroupId object_group_id;
+ /// Other properties of the object group to which the fault relates.
+ FT::MembershipStyleValue membership_style;
+ FT::ReplicationStyleValue replication_style;
+ FT::MinimumNumberReplicasValue minimum_number_replicas;
+ FT::InitialNumberReplicasValue initial_number_replicas;
+
};
} // namespace TAO
diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp
index e399dc83e77..135bacc585b 100644
--- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp
+++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp
@@ -16,8 +16,6 @@
#include "FT_Property_Validator.h"
#include "ace/Get_Opt.h"
-#include "orbsvcs/CosNamingC.h"
-#include "tao/PortableServer/ORB_Manager.h"
#include "orbsvcs/PortableGroup/PG_Properties_Decoder.h"
#include "orbsvcs/PortableGroup/PG_Properties_Encoder.h"
@@ -34,21 +32,27 @@ ACE_RCSID (FT_ReplicationManager,
FT_ReplicationManager,
"$Id$")
-
TAO::FT_ReplicationManager::FT_ReplicationManager ()
- : ior_output_file_(0)
+ : internals_()
+ , orb_(CORBA::ORB::_nil())
+ , iorm_(TAO_IOP::TAO_IOR_Manipulation::_nil())
+ , ior_output_file_(0)
, ns_name_(0)
- , internals_ ()
- , object_group_manager_ ()
+ , replication_manager_ref_(FT::ReplicationManager::_nil())
+ , naming_context_(CosNaming::NamingContext::_nil())
+ , object_group_manager_()
, property_manager_ (this->object_group_manager_)
, generic_factory_ (this->object_group_manager_, this->property_manager_)
+ , fault_notifier_(TAO::FT_FaultNotifier::_nil())
+ , fault_consumer_()
+ , test_iogr_(FT::ObjectGroup::_nil())
{
- // @note "this->init()" is not called here (in the constructor)
- // since it may thrown an exception. Throwing an exception in
- // a constructor in an emulated exception environment is
- // problematic since native exception semantics cannot be
- // reproduced in such a case. As such, init() must be called
- // by whatever code instantiates this ReplicationManager.
+ //@@Note: this->init() is not called here (in the constructor)
+ // since it may throw an exception. Throwing an exception in
+ // a constructor in an emulated exception environment is
+ // problematic since native exception semantics cannot be
+ // reproduced in such a case. As such, init() must be called
+ // by whatever code instantiates this ReplicationManager.
}
TAO::FT_ReplicationManager::~FT_ReplicationManager (void)
@@ -61,7 +65,7 @@ TAO::FT_ReplicationManager::~FT_ReplicationManager (void)
int TAO::FT_ReplicationManager::parse_args (int argc, char * argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "n:o:q");
+ ACE_Get_Opt get_opts (argc, argv, "n:o:");
int c;
while ((c = get_opts ()) != -1)
@@ -98,42 +102,59 @@ const char * TAO::FT_ReplicationManager::identity () const
return this->identity_.c_str();
}
-int TAO::FT_ReplicationManager::init (TAO_ORB_Manager & orbManager
- ACE_ENV_ARG_DECL)
+int TAO::FT_ReplicationManager::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL)
{
int result = 0;
- this->orb_ = orbManager.orb();
-
- // set our property validator
- FT_Property_Validator * property_validator;
- ACE_NEW_THROW_EX (
- property_validator,
- FT_Property_Validator,
- CORBA::NO_MEMORY ()
- );
- ACE_CHECK;
+ this->orb_ = CORBA::ORB::_duplicate (orb);
- this->property_manager_.init (property_validator);
+ // Create our Property Validator and set it on the Property Manager.
+ TAO::FT_Property_Validator * property_validator = 0;
+ ACE_NEW_RETURN (property_validator, TAO::FT_Property_Validator (), -1);
+ if (property_validator != 0)
+ {
+ this->property_manager_.init (property_validator);
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT (
+ "TAO::FT_ReplicationManager::init: "
+ "Could not create Property Validator.\n")),
+ -1);
+ }
- //TODO - the poa should be externally settable
- this->object_group_manager_.init (this->orb_, orbManager.root_poa());
+ // Get the RootPOA.
+ CORBA::Object_var poa_obj = this->orb_->resolve_initial_references (
+ TAO_OBJID_ROOTPOA ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ PortableServer::POA_var poa =
+ PortableServer::POA::_narrow (poa_obj.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
- // Get an object reference for the ORBs IORManipulation object!
- CORBA::Object_var IORM =
- this->orb_->resolve_initial_references (TAO_OBJID_IORMANIPULATION,
- 0
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ // Initialize the Object Group Manager.
+ this->object_group_manager_.init (this->orb_in(), poa.in());
- this->iorm_ = TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ // Get an object reference for the ORBs IORManipulation object.
+ CORBA::Object_var iorm_obj = this->orb_->resolve_initial_references (
+ TAO_OBJID_IORMANIPULATION ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
- // Register with the ORB.
- this->ior_ = orbManager.activate (this
- ACE_ENV_ARG_PARAMETER);
+ this->iorm_ = TAO_IOP::TAO_IOR_Manipulation::_narrow (
+ iorm_obj.in () ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ // Activate ourselves in the POA.
+ PortableServer::ObjectId_var oid = poa->activate_object (
+ this ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ CORBA::Object_var this_obj = poa->id_to_reference (
+ oid.in() ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+ this->replication_manager_ref_ = FT::ReplicationManager::_narrow (
+ this_obj.in() ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
+ // Publish our IOR, either to a file or the Naming Service.
if (this->ior_output_file_ != 0)
{
this->identity_ = "file:";
@@ -142,8 +163,6 @@ int TAO::FT_ReplicationManager::init (TAO_ORB_Manager & orbManager
}
else
{
- // if no IOR file specified,
- // then always try to register with name service
this->ns_name_ = "ReplicationManager";
}
@@ -214,14 +233,16 @@ int TAO::FT_ReplicationManager::write_ior()
FILE* out = ACE_OS::fopen (this->ior_output_file_, "w");
if (out)
{
- ACE_OS::fprintf (out, "%s", static_cast<const char *>(this->ior_));
+ CORBA::String_var ior_str = this->orb_->object_to_string (
+ this->replication_manager_ref_.in());
+ ACE_OS::fprintf (out, "%s", ior_str.in());
ACE_OS::fclose (out);
result = 0;
}
else
{
ACE_ERROR ((LM_ERROR,
- "Open failed for %s\n", this->ior_output_file_
+ ACE_TEXT("Open failed for %s\n"), this->ior_output_file_
));
}
return result;
diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h
index 738e73dcb03..6b49f0c14dc 100644
--- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h
+++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h
@@ -17,29 +17,22 @@
#include /**/ "ace/pre.h"
-#include "orbsvcs/FT_ReplicationManagerS.h"
-#include "orbsvcs/FT_NotifierC.h"
-#include "tao/IORManipulation/IORC.h"
-
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+//@@ Review all these header files and make sure they are all needed
+// or if some can be replaced with forward declarations.
+#include "orbsvcs/FT_ReplicationManagerS.h"
+#include "orbsvcs/FT_NotifierC.h"
+#include "tao/IORManipulation/IORC.h"
#include "orbsvcs/PortableGroupC.h"
-
#include "orbsvcs/PortableGroup/PG_PropertyManager.h"
#include "orbsvcs/PortableGroup/PG_GenericFactory.h"
#include "orbsvcs/PortableGroup/PG_ObjectGroupManager.h"
#include "orbsvcs/FaultTolerance/FT_Service_Activate.h"
-
-/////////////////////
-// Forward references
-
-//@@ The ORB_Manager has been deprecated, though it is still
-// used in various TAO services implementations. I recommend against
-// using it. -- Steve Totten
-class TAO_ORB_Manager;
-
+#include "orbsvcs/FT_ReplicationManager/FT_FaultConsumer.h"
+#include "orbsvcs/CosNamingC.h"
namespace TAO
{
@@ -81,7 +74,7 @@ namespace TAO
* @param orbManager our ORB -- we keep var to it.
* @return zero for success; nonzero is process return code for failure.
*/
- int init (TAO_ORB_Manager & orbManager ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ int init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL_WITH_DEFAULTS);
/**
* Prepare to exit.
@@ -421,26 +414,22 @@ namespace TAO
/// The orb
CORBA::ORB_var orb_;
- /// IOR of this object as assigned by orb.
- CORBA::String_var ior_;
-
- // The ORBs IORManipulation object
+ // The ORB's IORManipulation object
TAO_IOP::TAO_IOR_Manipulation_var iorm_;
/// A file to which the factory's IOR should be written.
const char * ior_output_file_;
- /// A dummy test IOGR used for unit testing (and its group id)
- CORBA::Object_var test_iogr_;
- CORBA::ULongLong test_iogr_group_id_;
-
-
/// A name to be used to register the factory with the name service.
+ //@@ Are *all* of these needed?
const char * ns_name_;
CosNaming::NamingContext_var naming_context_;
CosNaming::Name this_name_;
- /// A human-readable string to distinguish this from other Notifiers.
+ /// Our object reference.
+ FT::ReplicationManager_var replication_manager_ref_;
+
+ /// A human-readable string to identify this Replication Manager.
ACE_CString identity_;
/// The ObjectGroupManager that implements the functionality
@@ -454,8 +443,15 @@ namespace TAO
/// The GenericFactory responsible for creating all object groups.
TAO_PG_GenericFactory generic_factory_;
- /// The registered fault notifier
+ /// The fault notifier.
FT::FaultNotifier_var fault_notifier_;
+
+ /// The fault consumer.
+ TAO::FT_FaultConsumer fault_consumer_;
+
+ /// A dummy test IOGR used for unit testing (and its group id)
+ FT::ObjectGroup_var test_iogr_;
+ FT::ObjectGroupId test_iogr_group_id_;
};
} // namespace TAO
diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp
index 318168c6e50..7710778bdc5 100644
--- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp
+++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Main.cpp
@@ -13,13 +13,14 @@
*/
//=============================================================================
-#include <tao/Utils/ServantMain.h>
#include "FT_ReplicationManager.h"
+#include <tao/Utils/Server_Main.h>
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
- TAO::Utils::ServantMain<TAO::FT_ReplicationManager> servantMain("ReplicationManager");
- return servantMain.Main(argc, argv);
+ TAO::Utils::Server_Main<TAO::FT_ReplicationManager>
+ server_main("ReplicationManager");
+ return server_main.run(argc, argv);
}
///////////////////////////////////
@@ -27,8 +28,8 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// inept compilers.
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
- template TAO::Utils::ServantMain<FT_FaultDetectorFactory_i>;
+ template TAO::Utils::Server_Main<TAO::FT_ReplicationManager>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-# pragma instantiate TAO::Utils::ServantMain<FT_FaultDetectorFactory_i>
+# pragma instantiate TAO::Utils::Server_Main<TAO::FT_ReplicationManager>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp
index 98fec505fa4..1ffbb7ba000 100644
--- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp
+++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp
@@ -578,7 +578,7 @@ TAO_PG_GenericFactory::process_criteria (
// changed.
if (membership_style == PortableGroup::MEMB_INF_CTRL)
{
- if (minimum_number_replicas < minimum_number_replicas
+ if (minimum_number_replicas > initial_number_replicas
|| ACE_static_cast (CORBA::ULong,
minimum_number_replicas) > factory_infos_count)
{
diff --git a/TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp b/TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp
index c65183c97aa..eae1178f70d 100644
--- a/TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp
+++ b/TAO/orbsvcs/tests/FT_App/FT_UnitTests.cpp
@@ -19,6 +19,13 @@
#include <fstream>
+
+/////////////////////////////////////////////////////
+// Constants
+
+const CORBA::ULong MAX_TEST_FACTORIES = 10;
+
+
/////////////////////////////////////////////////////
// Test default properties
//
@@ -255,7 +262,7 @@ int FT_UnitTests::test_002 (int run_test,
FT::MinimumNumberReplicasValue minimum_number_replicas_out = 999;
FT::Value value;
-
+
// create a test type-id
const char * type_id = "IDL:FT_TEST/TestReplica:1.0";
@@ -389,7 +396,7 @@ int FT_UnitTests::test_003 (int run_test,
FT::MinimumNumberReplicasValue minimum_number_replicas_out = 999;
FT::Value value;
-
+
// create a test type-id
const char * type_id = "IDL:FT_TEST/TestReplica:1.0";
@@ -471,7 +478,7 @@ int FT_UnitTests::test_004 (int run_test,
FT::MinimumNumberReplicasValue minimum_number_replicas_in = 2;
FT::Value value;
-
+
// create a test type-id
const char * type_id = "IDL:FT_TEST/TestReplica:1.0";
@@ -490,6 +497,9 @@ int FT_UnitTests::test_004 (int run_test,
value <<= minimum_number_replicas_in;
encoder.add(::FT::FT_MINIMUM_NUMBER_REPLICAS, value);
+ value <<= (PortableGroup::FactoryInfos *)this->factories_;
+ encoder.add(::FT::FT_FACTORIES, value);
+
// allocate and populate the criteria
FT::Properties_var props_in;
ACE_NEW_NORETURN (props_in, FT::Properties);
@@ -766,18 +776,37 @@ int FT_UnitTests::parse_args (int argc, char * argv[])
}
case 'f':
{
- // use this list of iors to construct a list of
+ // use this list of iors to construct a list of
// FactoryInfos for the unit tests
char * file_list = get_opts.opt_arg ();
+
+ // create a FactoryInfos to hold the factory info
+ FT::FactoryInfos * temp = 0;
+ ACE_NEW_THROW_EX (temp,
+ FT::FactoryInfos,
+ CORBA::NO_MEMORY (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (1);
+
+ this->factories_ = temp;
+
char * delim;
char * ior_file;
- int count = 0;
- int i;
+ CORBA::ULong count = 0;
+ CORBA::ULong i = 0;
+
do
{
delim = ACE_OS::strchr (file_list, ';');
ior_file = file_list;
- if (delim != 0)
+ if (delim == 0)
+ {
+ file_list = 0; // make sure we terminate after this file
+ }
+ else
{
*delim = '\0';
file_list = delim + 1;
@@ -793,7 +822,7 @@ int FT_UnitTests::parse_args (int argc, char * argv[])
}
CORBA::Object_var obj = orb_->string_to_object(ior);
- FT::GenericFactory_var factory = factory.in();
+ FT::GenericFactory_var factory = FT::GenericFactory::_narrow(obj);
if (CORBA::is_nil(factory))
{
std::cerr << "Can't resolve GenericFactory IOR in " << ior_file << std::endl;
@@ -803,12 +832,14 @@ int FT_UnitTests::parse_args (int argc, char * argv[])
// create a dummy FactoryInfo for testing.
i = count++;
- factories_[i].the_factory = FT::GenericFactory::_narrow(obj);
- factories_.length(count);
- factories_[i].the_location.length (1);
- factories_[i].the_location[0].id = ior_file; // use filename as location
- factories_[i].the_criteria = 0;
- } while (delim != 0);
+ this->factories_->length(count);
+ this->factories_[i].the_factory = factory;
+ this->factories_[i].the_location.length (1);
+ // use filename as location
+ this->factories_[i].the_location[0].id = CORBA::string_dup(ior_file);
+
+ } while (file_list != 0);
+
break;
}
}
diff --git a/TAO/orbsvcs/tests/FT_App/FT_UnitTests.h b/TAO/orbsvcs/tests/FT_App/FT_UnitTests.h
index 3a425db7921..de1e54078c0 100644
--- a/TAO/orbsvcs/tests/FT_App/FT_UnitTests.h
+++ b/TAO/orbsvcs/tests/FT_App/FT_UnitTests.h
@@ -40,14 +40,14 @@ public:
/**
* Run a unit test
* @param the test-number of the test to run.
- * @return 0 if test ran successfully, any other
+ * @return 0 if test ran successfully, any other
* value is a failure.
*/
int run_test (int test_number);
/**
* Runs all unit tests.
- * @returns 0 if all tests were sucessful, otherwise
+ * @returns 0 if all tests were successful, otherwise
* returns the number of failed tests.
*/
int run_all_tests ();
@@ -95,8 +95,8 @@ private:
// an iogr for use in the unit tests
CORBA::Object_var test_iogr_;
- // A list of FactoryInfos ofr the unit tests
- FT::FactoryInfos factories_;
+ // A list of FactoryInfos for the unit tests
+ FT::FactoryInfos_var factories_;
};
diff --git a/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp b/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp
index 0ad3bb04860..17deef7f1a4 100755
--- a/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp
+++ b/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.cpp
@@ -155,7 +155,7 @@ int ReplicationManagerFaultConsumerAdapter::parse_args (int argc, char * argv[])
*/
int ReplicationManagerFaultConsumerAdapter::init (
CORBA::ORB_ptr orb
- ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_ENV_ARG_DECL)
{
ACE_DEBUG ((
LM_DEBUG,
diff --git a/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.h b/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.h
index bb3fc17fd0d..436e6ced685 100755
--- a/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.h
+++ b/TAO/orbsvcs/tests/FT_App/ReplicationManagerFaultConsumerAdapter.h
@@ -3,6 +3,7 @@
// $Id$
#ifndef REPLICATION_MANAGER_FAULT_CONSUMER_ADAPTER_H
#define REPLICATION_MANAGER_FAULT_CONSUMER_ADAPTER_H
+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
@@ -12,10 +13,6 @@
#include <orbsvcs/FT_FaultDetectorFactoryC.h>
#include <ace/Vector_T.h>
-//////////////////////
-// Forward references
-class TAO_ORB_Manager;
-
/////////////////////
// Class declarations