You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/12/11 01:00:45 UTC

svn commit: r1419913 - /incubator/mesos/branches/0.10.x/src/detector/detector.cpp

Author: benh
Date: Tue Dec 11 00:00:45 2012
New Revision: 1419913

URL: http://svn.apache.org/viewvc?rev=1419913&view=rev
Log:
Replaced another instance of boost::lexical_cast with numify.

Modified:
    incubator/mesos/branches/0.10.x/src/detector/detector.cpp

Modified: incubator/mesos/branches/0.10.x/src/detector/detector.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.10.x/src/detector/detector.cpp?rev=1419913&r1=1419912&r2=1419913&view=diff
==============================================================================
--- incubator/mesos/branches/0.10.x/src/detector/detector.cpp (original)
+++ incubator/mesos/branches/0.10.x/src/detector/detector.cpp Tue Dec 11 00:00:45 2012
@@ -22,15 +22,15 @@
 #include <ios>
 #include <vector>
 
-#include <boost/lexical_cast.hpp>
-
 #include <process/delay.hpp>
 #include <process/process.hpp>
 #include <process/protobuf.hpp>
 #include <process/timer.hpp>
 
 #include <stout/foreach.hpp>
+#include <stout/numify.hpp>
 #include <stout/option.hpp>
+#include <stout/try.hpp>
 
 #include "detector/detector.hpp"
 
@@ -46,8 +46,6 @@
 using namespace mesos;
 using namespace mesos::internal;
 
-using boost::lexical_cast;
-
 using process::Process;
 using process::Timer;
 using process::UPID;
@@ -477,9 +475,14 @@ void ZooKeeperMasterDetectorProcess::det
   string masterSeq;
   long min = LONG_MAX;
   foreach (const string& result, results) {
-    int i = lexical_cast<int>(result);
-    if (i < min) {
-      min = i;
+    Try<int> i = numify<int>(result);
+    if (i.isError()) {
+      LOG(WARNING) << "Unexpected znode at '" << url.path
+                   << "': " << i.error();
+      continue;
+    }
+    if (i.get() < min) {
+      min = i.get();
       masterSeq = result;
     }
   }