Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename Process.changeHost to process.migrate to match the MSG API
authorthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 26 Apr 2011 14:00:45 +0000 (14:00 +0000)
committerthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 26 Apr 2011 14:00:45 +0000 (14:00 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/contrib/trunk/simgrid-java@9890 48e7efb5-ca39-0410-a469-dd3cf9ba447f

org/simgrid/msg/MsgNative.java
org/simgrid/msg/Process.java
src/jmsg.c
src/jmsg.h

index c278bb1..b5f8765 100644 (file)
@@ -150,7 +150,7 @@ final class MsgNative {
         * @see                Process.migrate()
         * @see                Host.getByName()
         */
         * @see                Process.migrate()
         * @see                Host.getByName()
         */
-       final static native void processChangeHost(Process process, Host host) ;
+       final static native void processMigrate(Process process, Host host) ;
 
        /**
         * The natively implemented native to request the current process to sleep 
 
        /**
         * The natively implemented native to request the current process to sleep 
index 762dddb..1c85cf0 100644 (file)
@@ -266,11 +266,12 @@ public abstract class Process extends Thread {
        /**
         * Migrates a process to another host.
         *
        /**
         * Migrates a process to another host.
         *
+        * @param process               The process to migrate.
         * @param host                  The host where to migrate the process.
         *
         */
         * @param host                  The host where to migrate the process.
         *
         */
-       public void migrate(Host host)  {
-               MsgNative.processChangeHost(this, host);
+       public static void migrate(Process process, Host host)  {
+               MsgNative.processMigrate(process, host);
        }
        /**
         * Makes the current process sleep until time seconds have elapsed.
        }
        /**
         * Makes the current process sleep until time seconds have elapsed.
index 85ba6f5..30b5c2a 100644 (file)
@@ -280,9 +280,16 @@ Java_org_simgrid_msg_MsgNative_processSelf(JNIEnv * env, jclass cls)
 }
 
 JNIEXPORT void JNICALL
 }
 
 JNIEXPORT void JNICALL
-Java_org_simgrid_msg_MsgNative_processChangeHost(JNIEnv * env, jclass cls,
-                                             jobject jhost)
+Java_org_simgrid_msg_MsgNative_processMigrate(JNIEnv * env, jclass cls,
+                                             jobject jprocess, jobject jhost)
 {
 {
+  m_process_t process = jprocess_to_native_process(jprocess, env);
+
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
+    return;
+  }
+
   m_host_t host = jhost_get_native(env, jhost);
 
   if (!host) {
   m_host_t host = jhost_get_native(env, jhost);
 
   if (!host) {
@@ -291,9 +298,8 @@ Java_org_simgrid_msg_MsgNative_processChangeHost(JNIEnv * env, jclass cls,
   }
 
   /* try to change the host of the process */
   }
 
   /* try to change the host of the process */
-  MSG_error_t rv = MSG_process_change_host(host);
-
-  jxbt_check_res("MSG_process_change_host()", rv, MSG_OK,
+  MSG_error_t rv = MSG_process_migrate(process, host);
+  jxbt_check_res("MSG_process_migrate()", rv, MSG_OK,
                  bprintf("unexpected error , please report this bug"));
 
 }
                  bprintf("unexpected error , please report this bug"));
 
 }
index 14e7650..8bf5a94 100644 (file)
@@ -117,11 +117,11 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_MsgNative_processSelfPPID
 
 /*
  * Class               simgrid_msg_Msg
 
 /*
  * Class               simgrid_msg_Msg
- * Method              processChangeHost
+ * Method              processMigrate
  * Signature   (Lsimgrid/msg/Process;Lsimgrid/msg/Host;)V
  */
  * Signature   (Lsimgrid/msg/Process;Lsimgrid/msg/Host;)V
  */
-JNIEXPORT void JNICALL Java_org_simgrid_msg_MsgNative_processChangeHost
-    (JNIEnv *, jclass, jobject);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_MsgNative_processMigrate
+    (JNIEnv *, jclass, jobject, jobject);
 
 /*
  * Class               simgrid_msg_Msg
 
 /*
  * Class               simgrid_msg_Msg