Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new line at the end of the file, to avoid a gcc warning (turned into error by...
[simgrid.git] / src / java / jmsg_process.h
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier All right reserved. 
5  *
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.
8  *
9  * This contains the declarations of the functions in relation with the java
10  * process instance.
11  */
12  
13 #ifndef MSG_JPROCESS_H
14 #define MSG_JPROCESS_H
15
16 #include <jni.h>
17 #include "msg/msg.h"
18 #include "xbt/context.h"
19
20 /**
21  * This function returns a global reference to the  java process instance 
22  * specified by the parameter jprocess.
23  *
24  * @param jprocess              The original java process instance.
25  * @param env                   The env of the current thread
26  *
27  * @return                              The global reference to the original java process 
28  *                                              instance.
29  */                             
30 jobject
31 jprocess_new_global_ref(jobject jprocess,JNIEnv* env);
32
33 /**
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.
36  *
37  * @param                               The global refernce to delete.
38  * @param env                   The env of the current thread
39  *
40  * @see                                 jprocess_join()
41  * @see                                 jprocess_exit()
42  */
43 void
44 jprocess_delete_global_ref(jobject jprocess,JNIEnv* env);
45
46 /**
47  *
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 
50  * terminated.
51  * 
52  * @param jprocess              The java process to test.
53  * @param env                   The env of the current thread
54  *
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. 
59  *
60  * @return                              If the java process is alive the function returns
61  *                                              true. Otherwise the function returns false.
62  */ 
63 jboolean
64 jprocess_is_alive(jobject jprocess,JNIEnv* env);
65
66 /**
67  * This function waits for a java process to terminate.
68  *
69  * @param jprocess              The java process ot wait for.
70  * @param env                   The env of the current thread
71  *
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. 
76  *
77  */
78 void
79 jprocess_join(jobject jprocess,JNIEnv* env);
80
81 /**
82  * This function starts the specified java process.
83  *
84  * @param jprocess              The java process to start.
85  * @param env                   The env of the current thread
86  *
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. 
91  */
92 void
93 jprocess_start(jobject jprocess,JNIEnv* env);
94
95 /**
96  * This function forces the java process to stop.
97  *
98  * @param jprocess              The java process to stop.
99  * @param env                   The env of the current thread
100  *
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. 
105  */
106 void 
107 jprocess_exit(jobject jprocess,JNIEnv* env);
108
109 /**
110  * This function associated a native process to a java process instance.
111  *
112  * @param jprocess              The java process instance.
113  * @param process               The native process to bind.
114  * @param env                   The env of the current thread
115  *
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.  
120  */             
121 void
122 jprocess_bind(jobject jprocess,m_process_t process,JNIEnv* env);
123
124 /**
125  * This function returns a native process from a java process instance.
126  *
127  * @param jprocess              The java process object from which get the native process.
128  * @param env                   The env of the current thread
129  *
130  * @return                              The function returns the native process associated to the
131  *                                              java process object.
132  *
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.  
137  */
138 m_process_t
139 jprocess_to_native_process(jobject jprocess,JNIEnv* env);
140
141 /**
142  * This function gets the id of the specified java process.
143  *
144  * @param jprocess              The java process to get the id.
145  * @param env                   The env of the current thread
146  *
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.  
151  *
152  * @return                              The id of the specified java process.
153  */
154 jlong
155 jprocess_get_id(jobject jprocess,JNIEnv* env);
156
157 /**
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 
160  * process.
161  *
162  * @param jprocess              The java process to test the validity.
163  * @param env                   The env of the current thread
164  *
165  * @return                              If the java process is valid the function returns true.
166  *                                              Otherwise the function returns false.
167  */
168 jboolean
169 jprocess_is_valid(jobject jprocess,JNIEnv* env);
170
171 /**
172  * This function gets the name of the specified java process.
173  *
174  * @param jprocess              The java process to get the name.
175  * @param env                   The env of the current thread
176  *
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.  
181  *
182  * @return                              The name of the specified java process.
183  */
184 jstring
185 jprocess_get_name(jobject jprocess,JNIEnv* env);
186
187 /**
188  * This function yields the specified java process.
189  *
190  * @param jprocess              The java process to yield.
191  * @param env                   The env of the current thread.
192  *
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.
197  */
198 void 
199 jprocess_yield(jobject jprocess,JNIEnv* env);
200
201 /**
202  * This function locks the mutex of the specified java process.
203  *
204  * @param jprocess              The java process of the mutex to lock.
205  * @param env                   The env of the current thread.
206  *
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.
211  */
212 void
213 jprocess_lock_mutex(jobject jprocess,JNIEnv* env);
214
215 /**
216  * This function unlocks the mutex of the specified java process.
217  *
218  * @param jprocess              The java process of the mutex to unlock.
219  * @param env                   The env of the current thread.
220  *
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.
225  */
226 void
227 jprocess_unlock_mutex(jobject jprocess,JNIEnv* env);
228
229 /**
230  * This function signals the condition of the mutex of the specified java process.
231  *
232  * @param jprocess              The java process of the condtion to signal.
233  * @param env                   The env of the current thread.
234  *
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.
239  */
240 void
241 jprocess_signal_cond(jobject jprocess,JNIEnv* env);
242
243 /**
244  * This function waits the condition of the mutex of the specified java process.
245  *
246  * @param jprocess              The java process of the condtion to wait for.
247  * @param env                   The env of the current thread.
248  *
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.
253  */
254 void
255 jprocess_wait_cond(jobject jprocess,JNIEnv* env);
256
257 void
258 jprocess_schedule(xbt_context_t context);
259
260 void
261 jprocess_unschedule(xbt_context_t context);
262
263
264 #endif /* !MSG_JPROCESS_H */