[asterisk-scf-commits] asterisk-scf/integration/ice-util-c++.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Oct 20 11:41:43 CDT 2010


branch "master" has been updated
       via  f77ded29c18853e51f46a9493d1e63fac70accee (commit)
      from  07c51f8564573e23fd6cd90811c374a2de5dceed (commit)

Summary of changes:
 StateReplicator/src/StateReplicator.h |   67 ++++++++++++++++++++++++--------
 1 files changed, 50 insertions(+), 17 deletions(-)


- Log -----------------------------------------------------------------
commit f77ded29c18853e51f46a9493d1e63fac70accee
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Oct 20 11:40:50 2010 -0500

    Added try/catch on calls through listener.

diff --git a/StateReplicator/src/StateReplicator.h b/StateReplicator/src/StateReplicator.h
index bff5432..a745592 100644
--- a/StateReplicator/src/StateReplicator.h
+++ b/StateReplicator/src/StateReplicator.h
@@ -57,7 +57,19 @@ public:
    public:
       SetStateNotice(const U& stateSeq) : mStateSeq(stateSeq) {}
       ~SetStateNotice() {}
-      void operator() (T x) {x->stateSet(mStateSeq);}
+      void operator() (T x) 
+      {
+          try
+          {
+              x->stateSet(mStateSeq);
+          }
+          catch(const Ice::Exception&)
+          {
+          }
+          catch(...)
+          {
+          }
+      }
       U mStateSeq;
    };
 
@@ -70,7 +82,19 @@ public:
    public:
       RemoveStateNotice(const V& keys) : mKeys(keys) {}
       ~RemoveStateNotice() {}
-      void operator() (T x) {x->stateRemoved(mKeys);}
+      void operator() (T x) 
+      {
+          try
+          {
+              x->stateRemoved(mKeys);
+          }
+          catch(const Ice::Exception&)
+          {
+          }
+          catch(...)
+          {
+          }
+      }
       V mKeys;
    };
 
@@ -112,7 +136,16 @@ public:
 
        // Give this listener the current state.
        boost::shared_lock<boost::shared_mutex> lock(mStateLock); 
-       listener->stateSet(mStateItems);
+       try
+       {
+           listener->stateSet(mStateItems);
+       }
+       catch(const Ice::Exception&)
+       {
+       }
+       catch(...)
+       {
+       }
    }
 
    /**
@@ -194,22 +227,22 @@ public:
     */
    void removeState(const std::vector<K>& ids, const Ice::Current& = ::Ice::Current())
    {
-       {   // critical scope
-           boost::unique_lock<boost::shared_mutex> lock(mStateLock);
-
-           for (typename std::vector<K>::const_iterator keyIter = ids.begin(); keyIter != ids.end(); ++keyIter)
-           {
-               typename std::vector<S>::iterator locateIt = std::find_if(mStateItems.begin(), mStateItems.end(), MatchItem<S,K >(*keyIter));
+        {   // critical scope
+            boost::unique_lock<boost::shared_mutex> lock(mStateLock);
 
-               if (locateIt != mStateItems.end())
-               {
-                   mStateItems.erase(locateIt);
-               }
-           }
-       }
+            for (typename std::vector<K>::const_iterator keyIter = ids.begin(); keyIter != ids.end(); ++keyIter)
+            {
+                typename std::vector<S>::iterator locateIt = std::find_if(mStateItems.begin(), mStateItems.end(), MatchItem<S,K >(*keyIter));
 
-      boost::shared_lock<boost::shared_mutex> lock(mListenerLock);
-      for_each(mListeners.begin(), mListeners.end(), RemoveStateNotice<L,std::vector<K> >(ids));
+                if (locateIt != mStateItems.end())
+                {
+                    mStateItems.erase(locateIt);
+                }
+            }
+        }
+        
+        boost::shared_lock<boost::shared_mutex> lock(mListenerLock);
+        for_each(mListeners.begin(), mListeners.end(), RemoveStateNotice<L,std::vector<K> >(ids));
    }
 
     /**

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


-- 
asterisk-scf/integration/ice-util-c++.git



More information about the asterisk-scf-commits mailing list