JavaThreadTracker Class Reference

JavaThreadTracker implements ThreadTracker by attaching and detaching the Java environment. More...

#include <JavaThreadTracker.h>

Inheritance diagram for JavaThreadTracker:

ThreadTracker List of all members.

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 FennelExcncloneExcn (std::exception &ex)
 Clones an exception so that it can be rethrown in a different thread context.

Detailed Description

JavaThreadTracker implements ThreadTracker by attaching and detaching the Java environment.

Author:
John Sichi
Version:
Id
//open/dev/fennel/farrago/JavaThreadTracker.h#4

Definition at line 37 of file JavaThreadTracker.h.


Member Function Documentation

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.

Parameters:
ex the excn to be cloned
Returns:
cloned excn

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 }


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:33 2009 for Fennel by  doxygen 1.5.1