cpp: Prevent TFileTransport from throwing uncaught exceptions
authorDavid Reiss <dreiss@apache.org>
Tue, 9 Mar 2010 05:20:17 +0000 (05:20 +0000)
committerDavid Reiss <dreiss@apache.org>
Tue, 9 Mar 2010 05:20:17 +0000 (05:20 +0000)
commit8af018bf13789a48af8a49827a0d18d26925d73f
tree594eac09f6b2be97fc19fb18992468ec6d570ed1
parent1c20c871d218f479e101f6e9fb25231189d1bf72
cpp: Prevent TFileTransport from throwing uncaught exceptions

FilleTransport::writerThread throws exceptions. This function is run
inside the writer thread, so these exceptions are not caught. When these
exceptions happen, the system aborts.

The fix is to first eliminate all the throw commands inside this function. In
addition, add some error recovery logic into the code: whenever an IO error
happens, we enter into an error recovery mode. Go to sleep for a few seconds
then try to reopen the file.

Note: Currently, when errors happen, we drop events.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920686 13f79535-47bb-0310-9956-ffa450edef68
lib/cpp/src/transport/TFileTransport.cpp
lib/cpp/src/transport/TFileTransport.h