You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2011/09/09 06:10:33 UTC

svn commit: r1166992 - in /thrift/trunk/lib/cpp/src/concurrency: Exception.h ThreadManager.cpp

Author: jfarrell
Date: Fri Sep  9 04:10:32 2011
New Revision: 1166992

URL: http://svn.apache.org/viewvc?rev=1166992&view=rev
Log:
Thrift-1334: Add more info to IllegalStateException
Client cpp
Patch: Dave Watson

Add support for the message field in IllegalStateException


Modified:
    thrift/trunk/lib/cpp/src/concurrency/Exception.h
    thrift/trunk/lib/cpp/src/concurrency/ThreadManager.cpp

Modified: thrift/trunk/lib/cpp/src/concurrency/Exception.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/concurrency/Exception.h?rev=1166992&r1=1166991&r2=1166992&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/concurrency/Exception.h (original)
+++ thrift/trunk/lib/cpp/src/concurrency/Exception.h Fri Sep  9 04:10:32 2011
@@ -31,7 +31,11 @@ class UncancellableTaskException : publi
 
 class InvalidArgumentException : public apache::thrift::TException {};
 
-class IllegalStateException : public apache::thrift::TException {};
+class IllegalStateException : public apache::thrift::TException {
+public:
+  IllegalStateException() {}
+  IllegalStateException(const std::string& message) : TException(message) {}
+};
 
 class TimedOutException : public apache::thrift::TException {
 public:

Modified: thrift/trunk/lib/cpp/src/concurrency/ThreadManager.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/concurrency/ThreadManager.cpp?rev=1166992&r1=1166991&r2=1166992&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/concurrency/ThreadManager.cpp (original)
+++ thrift/trunk/lib/cpp/src/concurrency/ThreadManager.cpp Fri Sep  9 04:10:32 2011
@@ -467,7 +467,8 @@ void ThreadManager::Impl::removeWorker(s
     }
 
     if (state_ != ThreadManager::STARTED) {
-      throw IllegalStateException();
+      throw IllegalStateException("ThreadManager::Impl::add ThreadManager "
+                                  "not started");
     }
 
     removeExpiredTasks();
@@ -495,14 +496,16 @@ void ThreadManager::Impl::remove(shared_
   (void) task;
   Synchronized s(monitor_);
   if (state_ != ThreadManager::STARTED) {
-    throw IllegalStateException();
+    throw IllegalStateException("ThreadManager::Impl::remove ThreadManager not "
+                                "started");
   }
 }
 
 boost::shared_ptr<Runnable> ThreadManager::Impl::removeNextPending() {
   Guard g(mutex_);
   if (state_ != ThreadManager::STARTED) {
-    throw IllegalStateException();
+    throw IllegalStateException("ThreadManager::Impl::removeNextPending "
+                                "ThreadManager not started");
   }
 
   if (tasks_.empty()) {