MADARA  3.1.8
madara::threads::JavaThread Class Reference

A facade for a user-defined Java thread class. More...

#include <JavaThread.h>

Inheritance diagram for madara::threads::JavaThread:
Collaboration diagram for madara::threads::JavaThread:

Public Member Functions

 ~JavaThread ()
 Destructor. More...
 
bool check_compliance (jobject obj)
 Checks a Java object for compliance with com.madara.threads.BaseThread. More...
 
virtual void cleanup (void)
 Calls the Java cleanup method. More...
 
virtual void init (knowledge::KnowledgeBase &context)
 Initializes Java thread with MADARA context. More...
 
void operator= (const JavaThread &rhs)
 Assignment operator. More...
 
virtual void run (void)
 Executes the Java thread's logic. More...
 

Static Public Member Functions

static JavaThreadcreate (jobject obj)
 Creates a JavaThread. More...
 

Protected Member Functions

 JavaThread ()
 Constructor. More...
 
virtual void init_control_vars (knowledge::KnowledgeBase &control)
 Initializes the Java thread implementation's control plane variables. More...
 

Protected Attributes

jclass class_
 the class of the Java object obj_ More...
 
jmethodID cleanup_method_
 handle to the cleanup method More...
 
jmethodID init_method_
 handle to the init method More...
 
std::string name
 The unique name of your thread. More...
 
jobject obj_
 the Java thread implementation of com.madara.threads.BaseThread More...
 
madara::knowledge::containers::Integer paused
 thread safe paused flag that may be set by the Threader More...
 
jmethodID run_method_
 handle to the run method More...
 
madara::knowledge::containers::Integer terminated
 thread safe terminated flag that may be set by the Threader base More...
 

Detailed Description

A facade for a user-defined Java thread class.

Definition at line 26 of file JavaThread.h.

Constructor & Destructor Documentation

madara::threads::JavaThread::~JavaThread ( )

Destructor.

Definition at line 16 of file JavaThread.cpp.

madara::threads::JavaThread::JavaThread ( )
protected

Constructor.

Definition at line 10 of file JavaThread.cpp.

Member Function Documentation

bool madara::threads::JavaThread::check_compliance ( jobject  obj)

Checks a Java object for compliance with com.madara.threads.BaseThread.

Fills in class members if compliant.

Parameters
obja user-defined com.madara.threads.BaseThread object

Definition at line 135 of file JavaThread.cpp.

void madara::threads::JavaThread::cleanup ( void  )
virtual

Calls the Java cleanup method.

Reimplemented from madara::threads::BaseThread.

Definition at line 76 of file JavaThread.cpp.

threads::JavaThread * madara::threads::JavaThread::create ( jobject  obj)
static

Creates a JavaThread.

The obj is checked for compliance before returning a JavaThread.

Parameters
obja user-defined com.madara.threads.BaseThread object

Definition at line 121 of file JavaThread.cpp.

void madara::threads::JavaThread::init ( knowledge::KnowledgeBase context)
virtual

Initializes Java thread with MADARA context.

Parameters
contextcontext for querying current program state

Reimplemented from madara::threads::BaseThread.

Definition at line 89 of file JavaThread.cpp.

void madara::threads::JavaThread::init_control_vars ( knowledge::KnowledgeBase control)
protectedvirtual

Initializes the Java thread implementation's control plane variables.

Parameters
controlthe control plane between Threader and threads

Reimplemented from madara::threads::BaseThread.

Definition at line 229 of file JavaThread.cpp.

void madara::threads::JavaThread::operator= ( const JavaThread rhs)

Assignment operator.

Definition at line 33 of file JavaThread.cpp.

void madara::threads::JavaThread::run ( void  )
virtual

Executes the Java thread's logic.

Implements madara::threads::BaseThread.

Definition at line 63 of file JavaThread.cpp.

Member Data Documentation

jclass madara::threads::JavaThread::class_
protected

the class of the Java object obj_

Definition at line 88 of file JavaThread.h.

jmethodID madara::threads::JavaThread::cleanup_method_
protected

handle to the cleanup method

Definition at line 97 of file JavaThread.h.

jmethodID madara::threads::JavaThread::init_method_
protected

handle to the init method

Definition at line 94 of file JavaThread.h.

std::string madara::threads::BaseThread::name
protectedinherited

The unique name of your thread.

Definition at line 96 of file BaseThread.h.

jobject madara::threads::JavaThread::obj_
protected

the Java thread implementation of com.madara.threads.BaseThread

Definition at line 85 of file JavaThread.h.

madara::knowledge::containers::Integer madara::threads::BaseThread::paused
protectedinherited

thread safe paused flag that may be set by the Threader

Definition at line 107 of file BaseThread.h.

jmethodID madara::threads::JavaThread::run_method_
protected

handle to the run method

Definition at line 91 of file JavaThread.h.

madara::knowledge::containers::Integer madara::threads::BaseThread::terminated
protectedinherited

thread safe terminated flag that may be set by the Threader base

Definition at line 102 of file BaseThread.h.


The documentation for this class was generated from the following files: