#include <JavaThreadTracker.h>
Inheritance diagram for JavaThreadTracker:
Private Member Functions | |
virtual void | onThreadStart () |
Called in new thread context before thread's body runs. | |
virtual void | onThreadEnd () |
Called in thread context after thread's body runs. | |
virtual FennelExcn * | cloneExcn (std::exception &ex) |
Clones an exception so that it can be rethrown in a different thread context. |
Definition at line 37 of file JavaThreadTracker.h.
void JavaThreadTracker::onThreadStart | ( | ) | [private, virtual] |
Called in new thread context before thread's body runs.
Reimplemented from ThreadTracker.
Definition at line 30 of file JavaThreadTracker.cpp.
References JniEnvAutoRef::suppressDetach().
00031 { 00032 JniEnvAutoRef pEnv; 00033 // We want to stay attached for the duration of the timer thread, 00034 // so suppress detach here and do it explicitly in onThreadEnd 00035 // instead. See comments on suppressDetach about the need for a 00036 // cleaner approach to attaching native-spawned threads. 00037 pEnv.suppressDetach(); 00038 }
void JavaThreadTracker::onThreadEnd | ( | ) | [private, virtual] |
Called in thread context after thread's body runs.
Reimplemented from ThreadTracker.
Definition at line 40 of file JavaThreadTracker.cpp.
References JniUtil::detachJavaEnv().
00041 { 00042 JniUtil::detachJavaEnv(); 00043 }
FennelExcn * JavaThreadTracker::cloneExcn | ( | std::exception & | ex | ) | [private, virtual] |
Clones an exception so that it can be rethrown in a different thread context.
ex | the excn to be cloned |
Reimplemented from ThreadTracker.
Definition at line 45 of file JavaThreadTracker.cpp.
References ThreadTracker::cloneExcn(), and JavaExcn::getJavaException().
00046 { 00047 JavaExcn *pJavaExcn = dynamic_cast<JavaExcn *>(&ex); 00048 if (!pJavaExcn) { 00049 return ThreadTracker::cloneExcn(ex); 00050 } 00051 return new JavaExcn(pJavaExcn->getJavaException()); 00052 }