[asterisk-scf-commits] asterisk-scf/integration/ice-util-cpp.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Feb 15 18:41:08 CST 2012


branch "retry_deux" has been updated
       via  78c5c399a90d1b4b9a992240fba0682fda7414dc (commit)
      from  8f40afd174d340cec6eef706e6a20ceaa7eb5deb (commit)

Summary of changes:
 .../Discovery/LocatorRegistrationWrapper.h         |   11 ++--
 src/Component/Component.cpp                        |   55 +++++++++++++++-----
 2 files changed, 47 insertions(+), 19 deletions(-)


- Log -----------------------------------------------------------------
commit 78c5c399a90d1b4b9a992240fba0682fda7414dc
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Feb 15 18:41:04 2012 -0600

    Updates for further OperationContext propagation.

diff --git a/include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h b/include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h
index 48c5fbe..e870a58 100644
--- a/include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h
+++ b/include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h
@@ -22,6 +22,7 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/Helpers/Retry.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
 
 namespace AsteriskSCF
 {
@@ -121,7 +122,7 @@ public:
                 return;
             }
         }
-        mServiceManagement->unregister();
+        mServiceManagement->unregister(AsteriskSCF::createContext());
     }
 
     void suspend()
@@ -133,7 +134,7 @@ public:
                 return;
             }
         }
-        mServiceManagement->suspend();
+        mServiceManagement->suspend(AsteriskSCF::createContext());
     }
 
     void unsuspend()
@@ -145,7 +146,7 @@ public:
                 return;
             }
         }
-        mServiceManagement->unsuspend();
+        mServiceManagement->unsuspend(AsteriskSCF::createContext());
     }
 
     AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx getServiceManagement()
@@ -158,7 +159,7 @@ private:
     void addLocatorParams(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr& params,
         const std::string& comparatorGUID)
     {
-        mServiceManagement->addLocatorParams(mAddServiceOpContext, params, comparatorGUID);
+        mServiceManagement->addLocatorParams(mAddParamsOpContext, params, comparatorGUID);
     }
 
     /**
@@ -197,7 +198,7 @@ private:
     {
         mServiceManagement = 
             AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(
-                management->addService(mService, mName));
+                management->addService(mAddServiceOpContext, mService, mName));
     }
 
     /**
diff --git a/src/Component/Component.cpp b/src/Component/Component.cpp
index 70866e1..4b79ccc 100644
--- a/src/Component/Component.cpp
+++ b/src/Component/Component.cpp
@@ -28,6 +28,7 @@
 #include <AsteriskSCF/System/Component/ComponentServiceIf.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
 #include <AsteriskSCF/Discovery/LocatorRegistrationWrapper.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
 
 using namespace std;
 using namespace AsteriskSCF::System::Component::V1;
@@ -35,6 +36,7 @@ using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::Discovery;
 using namespace AsteriskSCF::Replication;
+using namespace AsteriskSCF::System::V1;
 
 namespace AsteriskSCF
 {
@@ -59,17 +61,17 @@ public:
     }
 
 public: // Overrides of the ComponentService interface.
-    void suspend(const ::Ice::Current&)
+    void suspend(const OperationContextPtr& operationContext, const ::Ice::Current&)
     {
         mComponent.suspended();
     }
 
-    void resume(const ::Ice::Current&)
+    void resume(const OperationContextPtr& operationContext, const ::Ice::Current&)
     {
         mComponent.resumed();
     }
 
-    void shutdown(const ::Ice::Current&)
+    void shutdown(const OperationContextPtr& operationContext, const ::Ice::Current&)
     {
         // This should probably get the icebox admin interface and call 
         // that shutdown() operartion. 
@@ -95,24 +97,28 @@ public:
     {
     }
 
-    void setTestMode(const std::string& mode, const ::Ice::Current&)
+    void setTestMode(const OperationContextPtr& operationContext,
+                    const std::string& mode, const ::Ice::Current&)
     {
         mComponent.setTestMode(mode);
     }
 
-    void setTestModeWithArgs(const std::string& mode, 
+    void setTestModeWithArgs(const OperationContextPtr& operationContext,
+                             const std::string& mode, 
                              const ComponentTestParamSeq& args, 
                              const ::Ice::Current&)
     {
         mComponent.setTestModeWithArgs(mode, args);
     }
 
-    void clearTestMode(const string& mode, const ::Ice::Current&)
+    void clearTestMode(const OperationContextPtr& operationContext,
+                       const string& mode, const ::Ice::Current&)
     {
         mComponent.clearTestMode(mode);
     }
 
-    void clearTestModes(const ::Ice::Current&)
+    void clearTestModes(const OperationContextPtr& operationContext,
+                        const ::Ice::Current&)
     {
         mComponent.clearTestModes();
     }
@@ -156,8 +162,14 @@ public:
         mProxyInitialized = true;
     }
 
-    bool activate(const ::Ice::Current&)
+    bool activate(const OperationContextPtr& operationContext,
+                  const ::Ice::Current&)
     {
+        if (mComponent.isActive())
+        {
+            return true;
+        }
+
         mComponent.activated();
 
         if (!mProxyInitialized)
@@ -168,13 +180,14 @@ public:
         for (vector<ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); 
              listener != mListeners.end(); ++listener)
         {
-            (*listener)->begin_activated(mReplicaPrx);
+            (*listener)->begin_activated(operationContext, mReplicaPrx);
         }
 
         return true;
     }
 
-    void standby(const ::Ice::Current&)
+    void standby(const OperationContextPtr& operationContext,
+                 const ::Ice::Current&)
     {
         mComponent.standby();
 
@@ -186,19 +199,33 @@ public:
         for (vector<ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); 
                 listener != mListeners.end(); ++listener)
         {
-            (*listener)->begin_onStandby(mReplicaPrx);
+            (*listener)->begin_onStandby(operationContext, mReplicaPrx);
         }
     }
 
-    void addListener(const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, 
+    void addListener(const OperationContextPtr& operationContext,
+                     const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, 
                      const ::Ice::Current&)
     {
+        vector<ReplicaListenerPrx>::iterator it = find(mListeners.begin(), mListeners.end(), listener);
+        if (it == mListeners.end())
+        {
+            return;
+        }
+
         mListeners.push_back(listener);
     }
 
-    void removeListener(const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, 
+    void removeListener(const OperationContextPtr& operationContext,
+                        const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, 
                         const ::Ice::Current&)
     {
+        vector<ReplicaListenerPrx>::iterator it = find(mListeners.begin(), mListeners.end(), listener);
+        if (it == mListeners.end())
+        {
+            return;
+        }
+
         mListeners.erase(std::remove(mListeners.begin(), mListeners.end(), listener), 
                          mListeners.end());
     }
@@ -217,7 +244,7 @@ private:
     /**
      * Listeners that we need to push state change notifications out to.
      */
-    vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx> mListeners;
+    vector<ReplicaListenerPrx> mListeners;
 
 }; // class ReplicaImpl
 

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


-- 
asterisk-scf/integration/ice-util-cpp.git



More information about the asterisk-scf-commits mailing list