X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/32a3008f360d90a28b60c66672da6ccee12f019e..07590d530fdab126f1f35077b6d2de7e81bdbf13:/src/jmsg_process.h?ds=sidebyside diff --git a/src/jmsg_process.h b/src/jmsg_process.h index 101c24851b..566a877ab1 100644 --- a/src/jmsg_process.h +++ b/src/jmsg_process.h @@ -1,6 +1,6 @@ /* Functions related to the java process instances. */ -/* Copyright (c) 2007, 2009, 2010. The SimGrid Team. +/* Copyright (c) 2007-2012. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -13,6 +13,21 @@ #include #include +//Cached java fields +jfieldID jprocess_field_Process_bind; +jfieldID jprocess_field_Process_host; +jfieldID jprocess_field_Process_killTime; +jfieldID jprocess_field_Process_id; +jfieldID jprocess_field_Process_name; +jfieldID jprocess_field_Process_pid; +jfieldID jprocess_field_Process_ppid; + +JNIEXPORT void JNICALL +Java_org_simgrid_msg_Process_exit(JNIEnv *env, jobject); + + +jobject native_to_java_process(msg_process_t process); + /** * This function returns a global reference to the java process instance * specified by the parameter jprocess. @@ -37,24 +52,6 @@ jobject jprocess_new_global_ref(jobject jprocess, JNIEnv * env); */ void jprocess_delete_global_ref(jobject jprocess, JNIEnv * env); -/** - * - * This function tests if the specified java process instance is alive. - * A java process object is alive if it has been started and has not yet - * terminated. - * - * @param jprocess The java process to test. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the methos isAlive() of - * this class is not found the function throws the exception - * NotSuchMethodException. - * - * @return If the java process is alive the function returns - * true. Otherwise the function returns false. - */ -jboolean jprocess_is_alive(jobject jprocess, JNIEnv * env); /** * This function waits for a java process to terminate. @@ -69,33 +66,6 @@ jboolean jprocess_is_alive(jobject jprocess, JNIEnv * env); * */ void jprocess_join(jobject jprocess, JNIEnv * env); - -/** - * This function starts the specified java process. - * - * @param jprocess The java process to start. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the methos start() of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_start(jobject jprocess, JNIEnv * env); - -/** - * This function forces the java process to stop. - * - * @param jprocess The java process to stop. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the methos stop() of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_exit(jobject jprocess, JNIEnv * env); - /** * This function associated a native process to a java process instance. * @@ -108,7 +78,7 @@ void jprocess_exit(jobject jprocess, JNIEnv * env); * this class is not found the function throws the exception * NotSuchFieldException. */ -void jprocess_bind(jobject jprocess, m_process_t process, JNIEnv * env); +void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv * env); /** * This function returns a native process from a java process instance. @@ -124,7 +94,7 @@ void jprocess_bind(jobject jprocess, m_process_t process, JNIEnv * env); * this class is not found the function throws the exception * NotSuchFieldException. */ -m_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env); +msg_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env); /** * This function gets the id of the specified java process. @@ -169,74 +139,130 @@ jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env); */ jstring jprocess_get_name(jobject jprocess, JNIEnv * env); -/** - * This function yields the specified java process. - * - * @param jprocess The java process to yield. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method switchProcess of - * this class is not found the function throws the exception - * NotSuchMethodException. +/* + * Class org_simgrid_msg_Process + * Method nativeInit + * Signature (); */ -void jprocess_yield(jobject jprocess, JNIEnv * env); +JNIEXPORT void JNICALL +Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jclass cls); -/** - * This function locks the mutex of the specified java process. - * - * @param jprocess The java process of the mutex to lock. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method lockMutex of - * this class is not found the function throws the exception - * NotSuchMethodException. +/* + * Class org_simgrid_msg_Process + * Method create + * Signature (Lorg/simgrid/msg/Host;)V */ -void jprocess_lock_mutex(jobject jprocess, JNIEnv * env); +JNIEXPORT void JNICALL +Java_org_simgrid_msg_Process_create(JNIEnv * env, + jobject jprocess_arg, + jobject jhostname); -/** - * This function unlocks the mutex of the specified java process. - * - * @param jprocess The java process of the mutex to unlock. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method unlockMutex of - * this class is not found the function throws the exception - * NotSuchMethodException. +/* + * Class org_simgrid_msg_Process + * Method killAll + * Signature (I)I */ -void jprocess_unlock_mutex(jobject jprocess, JNIEnv * env); +JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll + (JNIEnv *, jclass, jint); -/** - * This function signals the condition of the mutex of the specified java process. - * - * @param jprocess The java process of the condtion to signal. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method signalCond of - * this class is not found the function throws the exception - * NotSuchMethodException. +/* + * Class org_simgrid_msg_Process + * Method fromPID + * Signature (I)Lorg/simgrid/msg/Process; */ -void jprocess_signal_cond(jobject jprocess, JNIEnv * env); +JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID + (JNIEnv *, jclass, jint); +/* + * Class org_simgrid_msg_Process + * Method waitFor + * Signature (D)V + */ +JNIEXPORT jobject JNICALL +Java_org_simgrid_msg_Process_getProperty(JNIEnv *env, jobject jprocess, jobject jname); +/* + * Class org_simgrid_msg_Process + * Method currentProcess + * Signature ()Lorg/simgrid/msg/Process; + */ +JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_currentProcess + (JNIEnv *, jclass); +/* + * Class org_simgrid_msg_Process + * Method suspend + * Signature (Lorg/simgrid/msg/Process;)V + */ +JNIEXPORT void JNICALL +Java_org_simgrid_msg_Process_suspend(JNIEnv * env, + jobject jprocess); +/* + * Class org_simgrid_msg_Process + * Method resume + * Signature (Lorg/simgrid/msg/Process;)V + */ +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume + (JNIEnv *, jobject); +/* + * Class org_simgrid_msg_Process + * Method setAutoRestart + * Signature (Lorg/simgrid/msg/Process;Z)V + */ +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setAutoRestart + (JNIEnv *, jobject, jboolean); +/* + * Class org_simgrid_msg_Process + * Method restart + * Signature (Lorg/simgrid/msg/Process;)V + */ +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart + (JNIEnv *, jobject); -/** - * This function waits the condition of the mutex of the specified java process. - * - * @param jprocess The java process of the condtion to wait for. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method waitCond of - * this class is not found the function throws the exception - * NotSuchMethodException. +/* + * Class org_simgrid_msg_Process + * Method isSuspended + * Signature (Lorg/simgrid/msg/Process;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended + (JNIEnv *, jobject); +/* + * Class org_simgrid_msg_Process + * Method sleep + * Signature (DI)V + */ +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep + (JNIEnv *, jclass, jlong, jint); + +/* + * Class org_simgrid_msg_Process + * Method waitFor + * Signature (D)V + */ +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_waitFor + (JNIEnv *, jobject, jdouble); +/* + * Class org_simgrid_msg_Process + * Method kill + * Signature (Lorg/simgrid/msg/Process;)V */ -void jprocess_wait_cond(jobject jprocess, JNIEnv * env); +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_kill + (JNIEnv *, jobject); -void jprocess_schedule(smx_context_t context); +/* + * Class org_simgrid_msg_Process + * Method migrate + * Signature (Lorg/simgrid/msg/Host;)V + */ +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate + (JNIEnv *, jobject, jobject); +/* + * Class org_simgrid_msg_Process + * Method setKillTime + * Signature (D)V + */ +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime + (JNIEnv *, jobject, jdouble); -void jprocess_unschedule(smx_context_t context); +JNIEXPORT jint JNICALL +Java_org_simgrid_msg_Process_getCount(JNIEnv * env, jclass cls); #endif /* !MSG_JPROCESS_H */