예제 #1
0
JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_internalmig(JNIEnv *env, jobject jvm, jobject jhost)
{
  msg_vm_t vm = jvm_get_native(env,jvm);
  msg_host_t host = jhost_get_native(env, jhost);
  try {
    MSG_vm_migrate(vm,host);
  }
  catch(xbt_ex& e){
     XBT_VERB("CATCH EXCEPTION MIGRATION %s",e.what());
     jxbt_throw_host_failure(env, (char*)"during migration");
  }
}
예제 #2
0
void jmsg_throw_status(JNIEnv *env, msg_error_t status) {
  switch (status) {
    case MSG_TIMEOUT:
        jxbt_throw_time_out_failure(env,nullptr);
    break;
    case MSG_TRANSFER_FAILURE:
        jxbt_throw_transfer_failure(env,nullptr);
    break;
    case MSG_HOST_FAILURE:
        jxbt_throw_host_failure(env,nullptr);
    break;
    case MSG_TASK_CANCELED:
        jxbt_throw_task_cancelled(env,nullptr);
    break;
    default:
        jxbt_throw_native(env,xbt_strdup("undefined message failed "
          "(please see jmsg_throw_status function in jmsg.cpp)"));
  }
}
예제 #3
0
JNIEXPORT void JNICALL
Java_org_simgrid_msg_Process_sleep(JNIEnv *env, jclass cls, jlong jmillis, jint jnanos)
 {
  double time =  ((double)jmillis) / 1000 + ((double)jnanos) / 1000000000;
  msg_error_t rv;
  rv = MSG_process_sleep(time);
  if (rv != MSG_OK) {
    XBT_DEBUG("Something during the MSG_process_sleep invocation was wrong, trigger a HostFailureException");

    //jmsg_throw_status(env,rv);

    // adsein, the code above as been replaced by the code below. Indeed, according to the documentation, a sleep can only 
    // trigger a host_failure exception. When the sleep crashes due to a host shutdown, the exception thrown by smx_context_java.c
    // is a cancelled_error, see bindings/java/smx_context_java.c, function void smx_ctx_java_stop(smx_context_t context) and src/msg/msg_gos.c
    // function  msg_error_t MSG_process_sleep(double nb_sec)

    jxbt_throw_host_failure(env,NULL);
  }
}