4 * Copyright 2006,2007 Martin Quinson, Malek Cherier All right reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package.
9 * This contains the declarations of the functions in relation with the java
13 #ifndef MSG_JPROCESS_H
14 #define MSG_JPROCESS_H
18 #include "xbt/context.h"
21 * This function returns a global reference to the java process instance
22 * specified by the parameter jprocess.
24 * @param jprocess The original java process instance.
25 * @param env The env of the current thread
27 * @return The global reference to the original java process
31 jprocess_new_global_ref(jobject jprocess,JNIEnv* env);
34 * This function delete a global reference to a java process instance.
35 * If the java process is alive the function joins it and stops it before.
37 * @param The global refernce to delete.
38 * @param env The env of the current thread
40 * @see jprocess_join()
41 * @see jprocess_exit()
44 jprocess_delete_global_ref(jobject jprocess,JNIEnv* env);
48 * This function tests if the specified java process instance is alive.
49 * A java process object is alive if it has been started and has not yet
52 * @param jprocess The java process to test.
53 * @param env The env of the current thread
55 * @exception If the class Process is not found the function throws
56 * the ClassNotFoundException. If the methos isAlive() of
57 * this class is not found the function throws the exception
58 * NotSuchMethodException.
60 * @return If the java process is alive the function returns
61 * true. Otherwise the function returns false.
64 jprocess_is_alive(jobject jprocess,JNIEnv* env);
67 * This function waits for a java process to terminate.
69 * @param jprocess The java process ot wait for.
70 * @param env The env of the current thread
72 * @exception If the class Process is not found the function throws
73 * the ClassNotFoundException. If the methos join() of
74 * this class is not found the function throws the exception
75 * NotSuchMethodException.
79 jprocess_join(jobject jprocess,JNIEnv* env);
82 * This function starts the specified java process.
84 * @param jprocess The java process to start.
85 * @param env The env of the current thread
87 * @exception If the class Process is not found the function throws
88 * the ClassNotFoundException. If the methos start() of
89 * this class is not found the function throws the exception
90 * NotSuchMethodException.
93 jprocess_start(jobject jprocess,JNIEnv* env);
96 * This function forces the java process to stop.
98 * @param jprocess The java process to stop.
99 * @param env The env of the current thread
101 * @exception If the class Process is not found the function throws
102 * the ClassNotFoundException. If the methos stop() of
103 * this class is not found the function throws the exception
104 * NotSuchMethodException.
107 jprocess_exit(jobject jprocess,JNIEnv* env);
110 * This function associated a native process to a java process instance.
112 * @param jprocess The java process instance.
113 * @param process The native process to bind.
114 * @param env The env of the current thread
116 * @exception If the class Process is not found the function throws
117 * the ClassNotFoundException. If the field bind of
118 * this class is not found the function throws the exception
119 * NotSuchFieldException.
122 jprocess_bind(jobject jprocess,m_process_t process,JNIEnv* env);
125 * This function returns a native process from a java process instance.
127 * @param jprocess The java process object from which get the native process.
128 * @param env The env of the current thread
130 * @return The function returns the native process associated to the
131 * java process object.
133 * @exception If the class Process is not found the function throws
134 * the ClassNotFoundException. If the field bind of
135 * this class is not found the function throws the exception
136 * NotSuchFieldException.
139 jprocess_to_native_process(jobject jprocess,JNIEnv* env);
142 * This function gets the id of the specified java process.
144 * @param jprocess The java process to get the id.
145 * @param env The env of the current thread
147 * @exception If the class Process is not found the function throws
148 * the ClassNotFoundException. If the field id of
149 * this class is not found the function throws the exception
150 * NotSuchFieldException.
152 * @return The id of the specified java process.
155 jprocess_get_id(jobject jprocess,JNIEnv* env);
158 * This function tests if a java process instance is valid.
159 * A java process object is valid if it is bind to a native
162 * @param jprocess The java process to test the validity.
163 * @param env The env of the current thread
165 * @return If the java process is valid the function returns true.
166 * Otherwise the function returns false.
169 jprocess_is_valid(jobject jprocess,JNIEnv* env);
172 * This function gets the name of the specified java process.
174 * @param jprocess The java process to get the name.
175 * @param env The env of the current thread
177 * @exception If the class Process is not found the function throws
178 * the ClassNotFoundException. If the field name of
179 * this class is not found the function throws the exception
180 * NotSuchFieldException.
182 * @return The name of the specified java process.
185 jprocess_get_name(jobject jprocess,JNIEnv* env);
188 * This function yields the specified java process.
190 * @param jprocess The java process to yield.
191 * @param env The env of the current thread.
193 * @exception If the class Process is not found the function throws
194 * the ClassNotFoundException. If the method switchProcess of
195 * this class is not found the function throws the exception
196 * NotSuchMethodException.
199 jprocess_yield(jobject jprocess,JNIEnv* env);
202 * This function locks the mutex of the specified java process.
204 * @param jprocess The java process of the mutex to lock.
205 * @param env The env of the current thread.
207 * @exception If the class Process is not found the function throws
208 * the ClassNotFoundException. If the method lockMutex of
209 * this class is not found the function throws the exception
210 * NotSuchMethodException.
213 jprocess_lock_mutex(jobject jprocess,JNIEnv* env);
216 * This function unlocks the mutex of the specified java process.
218 * @param jprocess The java process of the mutex to unlock.
219 * @param env The env of the current thread.
221 * @exception If the class Process is not found the function throws
222 * the ClassNotFoundException. If the method unlockMutex of
223 * this class is not found the function throws the exception
224 * NotSuchMethodException.
227 jprocess_unlock_mutex(jobject jprocess,JNIEnv* env);
230 * This function signals the condition of the mutex of the specified java process.
232 * @param jprocess The java process of the condtion to signal.
233 * @param env The env of the current thread.
235 * @exception If the class Process is not found the function throws
236 * the ClassNotFoundException. If the method signalCond of
237 * this class is not found the function throws the exception
238 * NotSuchMethodException.
241 jprocess_signal_cond(jobject jprocess,JNIEnv* env);
244 * This function waits the condition of the mutex of the specified java process.
246 * @param jprocess The java process of the condtion to wait for.
247 * @param env The env of the current thread.
249 * @exception If the class Process is not found the function throws
250 * the ClassNotFoundException. If the method waitCond of
251 * this class is not found the function throws the exception
252 * NotSuchMethodException.
255 jprocess_wait_cond(jobject jprocess,JNIEnv* env);
258 jprocess_schedule(xbt_context_t context);
261 jprocess_unschedule(xbt_context_t context);
264 #endif /* !MSG_JPROCESS_H */