MADARA  3.1.8
JavaThread.h
Go to the documentation of this file.
1 
2 
3 #ifndef _MADARA_THREADS_JAVA_THREAD_H_
4 #define _MADARA_THREADS_JAVA_THREAD_H_
5 
14 #include <jni.h>
15 #include "madara_jni.h"
16 
18 
19 namespace madara
20 {
21  namespace threads
22  {
26  class JavaThread : public BaseThread
27  {
28  public:
29 
33  ~JavaThread ();
34 
38  void operator= (const JavaThread & rhs);
39 
44  virtual void init (knowledge::KnowledgeBase & context);
45 
49  virtual void run (void);
50 
54  virtual void cleanup (void);
55 
61  static JavaThread * create (jobject obj);
62 
68  bool check_compliance (jobject obj);
69 
70  protected:
71 
75  JavaThread ();
76 
81  virtual void init_control_vars (
82  knowledge::KnowledgeBase & control);
83 
85  jobject obj_;
86 
88  jclass class_;
89 
91  jmethodID run_method_;
92 
94  jmethodID init_method_;
95 
97  jmethodID cleanup_method_;
98  };
99  }
100 }
101 
102 #endif // _MADARA_THREADS_JAVA_THREAD_H_
jmethodID run_method_
handle to the run method
Definition: JavaThread.h:91
bool check_compliance(jobject obj)
Checks a Java object for compliance with com.madara.threads.BaseThread.
Definition: JavaThread.cpp:135
jclass class_
the class of the Java object obj_
Definition: JavaThread.h:88
virtual void run(void)
Executes the Java thread&#39;s logic.
Definition: JavaThread.cpp:63
Provides a quality-of-service-enabled threading library.
Definition: BaseThread.h:27
virtual void init_control_vars(knowledge::KnowledgeBase &control)
Initializes the Java thread implementation&#39;s control plane variables.
Definition: JavaThread.cpp:229
Abstract base class for implementing threads.
Definition: BaseThread.h:38
virtual void cleanup(void)
Calls the Java cleanup method.
Definition: JavaThread.cpp:76
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
void operator=(const JavaThread &rhs)
Assignment operator.
Definition: JavaThread.cpp:33
virtual void init(knowledge::KnowledgeBase &context)
Initializes Java thread with MADARA context.
Definition: JavaThread.cpp:89
jmethodID cleanup_method_
handle to the cleanup method
Definition: JavaThread.h:97
jmethodID init_method_
handle to the init method
Definition: JavaThread.h:94
Copyright (c) 2015 Carnegie Mellon University.
jobject obj_
the Java thread implementation of com.madara.threads.BaseThread
Definition: JavaThread.h:85
A facade for a user-defined Java thread class.
Definition: JavaThread.h:26
static JavaThread * create(jobject obj)
Creates a JavaThread.
Definition: JavaThread.cpp:121