[asterisk-scf-commits] asterisk-scf/integration/servicediscovery.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed May 2 11:44:54 CDT 2012


branch "retry_deux" has been updated
       via  6aa3a338e2d45f7b8fc63afbf35e2ee4bdd59453 (commit)
      from  d4e117296c1a778be8bdec551f6911577c3eb15e (commit)

Summary of changes:
 src/ServiceLocator.cpp |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 6aa3a338e2d45f7b8fc63afbf35e2ee4bdd59453
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed May 2 11:44:17 2012 -0500

    Added test for state replicator proxy and additional logging messages.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 3165c6f..9256ed4 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -333,6 +333,7 @@ void ServiceLocatorApp::start(const string& appName, const Ice::CommunicatorPtr&
 
     mManagementAdapter->activate();
 
+    bool standAlone = getBooleanPropertyValueWithDefault(communicator->getProperties(), appName + ".Standalone", false);
     try
     {
 	mStateReplicator = ServiceLocatorStateReplicatorPrx::checkedCast(communicator->propertyToProxy(appName + ".StateReplicator.Proxy"));
@@ -341,15 +342,23 @@ void ServiceLocatorApp::start(const string& appName, const Ice::CommunicatorPtr&
 
 	locatorServiceManagement->setStateReplicator(mStateReplicator);
 
-        if (getBooleanPropertyValueWithDefault(communicator->getProperties(), appName + ".Standalone", false))
+        if (standAlone)
         {
-            lg(Info) << "Operating in an active state and pushing updates." << endl;
+            lg(Info) << "Operating in an active, standalone state and pushing updates." << endl;
         }
         else 
         {
             // The default state is standby, in a replica group. 
             // In this state, the component must be activated via it's Replica interface.
 	    mReplicaService->standby(AsteriskSCF::Operations::createContext());
+
+            if (mStateReplicator == 0)
+            {
+                lg(Error) << "Operating in replica group with no access to state replicator defined!" << endl;
+                lg(Error) << "--- Check config file for <servicename>.StateReplicator.Proxy setting, or run standalone." << endl;
+                assert(false);
+            }
+
             mStateReplicator->addListener(AsteriskSCF::Operations::createContext(), replicatorListenerProxy);
             lg(Info) << "Operating as a standby replica." << endl;
         }
@@ -392,7 +401,14 @@ void ServiceLocatorApp::start(const string& appName, const Ice::CommunicatorPtr&
 
     lg(Info) << "Activated service discovery.";
 
-    lg(Info) << "Waiting for requests.";
+    if (standAlone)
+    {
+        lg(Info) << "Waiting for requests.";
+    }
+    else
+    {
+        lg(Info) << "In stanby mode.";
+    }
 }
 
 void ServiceLocatorApp::stop()

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/servicediscovery.git



More information about the asterisk-scf-commits mailing list