mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1393826 - /incubator/mesos/trunk/src/detector/detector.cpp
Date Wed, 03 Oct 2012 23:37:44 GMT
Author: benh
Date: Wed Oct  3 23:37:43 2012
New Revision: 1393826

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

Modified:
    incubator/mesos/trunk/src/detector/detector.cpp

Modified: incubator/mesos/trunk/src/detector/detector.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/detector/detector.cpp?rev=1393826&r1=1393825&r2=1393826&view=diff
==============================================================================
--- incubator/mesos/trunk/src/detector/detector.cpp (original)
+++ incubator/mesos/trunk/src/detector/detector.cpp Wed Oct  3 23:37:43 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;
@@ -474,9 +472,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;
     }
   }



Mime
View raw message