Exemple #1
0
void jxbt_throw_notbound(JNIEnv * env, const char *kind, void *pointer)
{
  jxbt_throw_by_name(env,
                     "org/simgrid/msg/JniException",
                     bprintf("Internal error: %s %p not bound", kind,
                             pointer));
}
Exemple #2
0
void JavaContext::stop()
{
  /* I am the current process and I am dying */
  if (this->iwannadie) {
    this->iwannadie = 0;
    JNIEnv *env = get_current_thread_env();
    XBT_DEBUG("Gonna launch Killed Error");
    // TODO Adrien, if the process has not been created at the java layer, why should we raise the exception/error at the java level (this happens
    // for instance during the migration process that creates at the C level two processes: one on the SRC node and one on the DST node, if the DST process is killed.
    // it is not required to raise an exception at the JAVA level, the low level should be able to manage such an issue correctly but this is not the case right now unfortunately ...
    // TODO it will be nice to have the name of the process to help the end-user to know which Process has been killed
   // jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", bprintf("Process %s killed :) (file smx_context_java.c)", MSG_process_get_name( (msg_process_t)context) ));
    jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError",
      bprintf("Process %s killed :) (file JavaContext.cpp)",
      simcall_process_get_name((smx_process_t) SIMIX_context_get_process(this))) );
    XBT_DEBUG("Trigger a cancel error at the C level");
    THROWF(cancel_error, 0, "process cancelled");
  } else {
    Context::stop();
    /* detach the thread and kills it */
    JNIEnv *env = this->jenv;
    env->DeleteGlobalRef(this->jprocess);
    XBT_ATTRIB_UNUSED jint error = __java_vm->DetachCurrentThread();
    xbt_assert((error == JNI_OK), "The thread couldn't be detached.");
    xbt_os_sem_release(this->end);
    xbt_os_thread_exit(NULL);
  }
}
Exemple #3
0
// host failure Exception
void jxbt_throw_host_failure(JNIEnv * env, char *details)
{

  jxbt_throw_by_name(env,
                     "org/simgrid/msg/HostFailureException",
                     bprintf("Host Failure %s", details));

}
void smx_ctx_cojava_stop(smx_context_t context)
{
  /*
   * The java stack needs to be empty, otherwise weird stuff
   * will happen
   */
  if (context->iwannadie) {
    context->iwannadie = 0;
    JNIEnv *env = get_current_thread_env();
    // TODO it will be nice to have the name of the process to help the end-user to know which Process has been killed
    jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", xbt_strdup("Process killed :) (file smx_context_cojava.c)"));
    THROWF(cancel_error, 0, "process cancelled");
  }
  else {
    smx_ctx_base_stop(context);
    smx_ctx_cojava_suspend(context);
  }
}
Exemple #5
0
void jxbt_throw_transfer_failure(JNIEnv* env, const std::string& details)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/TransferFailureException", details);
}
Exemple #6
0
void jxbt_throw_storage_not_found(JNIEnv* env, const std::string& invalid_name)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/StorageNotFoundException", "No such storage: " + invalid_name);
}
Exemple #7
0
void jxbt_throw_process_not_found(JNIEnv* env, const std::string& invalid_name)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/ProcessNotFoundException", "No such process: " + invalid_name);
}
Exemple #8
0
void jxbt_throw_illegal(JNIEnv* env, const std::string& msg)
{
  jxbt_throw_by_name(env, "java/lang/IllegalArgumentException", msg);
}
Exemple #9
0
void jxbt_throw_host_not_found(JNIEnv* env, const std::string& invalid_name)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/HostNotFoundException", "No such host: " + invalid_name);
}
Exemple #10
0
void jxbt_throw_native(JNIEnv * env, char *msg)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/NativeException", msg);
}
Exemple #11
0
void jxbt_throw_null(JNIEnv* env, const std::string& msg)
{
  jxbt_throw_by_name(env, "java/lang/NullPointerException", msg);
}
Exemple #12
0
void jxbt_throw_host_failure(JNIEnv* env, const std::string& details)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/HostFailureException", "Host Failure " + details);
}
Exemple #13
0
void jxbt_throw_task_cancelled(JNIEnv* env, const std::string& details)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/TaskCancelledException", details);
}
Exemple #14
0
/* *** */
void jxbt_throw_null(JNIEnv * env, char *msg)
{
  jxbt_throw_by_name(env, "java/lang/NullPointerException", msg);
}
Exemple #15
0
void jxbt_throw_process_not_found(JNIEnv * env, const char *invalid_name)
{
  jxbt_throw_by_name(env,
                     "org/simgrid/msg/ProcessNotFoundException",
                     bprintf("No such process: %s", invalid_name));
}
Exemple #16
0
void jxbt_throw_storage_not_found(JNIEnv * env, const char *invalid_name)
{
  jxbt_throw_by_name(env,
                     "org/simgrid/msg/StorageNotFoundException",
                     bprintf("No such storage: %s", invalid_name));
}
Exemple #17
0
void jxbt_throw_host_not_found(JNIEnv * env, const char *invalid_name)
{
  jxbt_throw_by_name(env,
                     "org/simgrid/msg/HostNotFoundException",
                     bprintf("No such host: %s", invalid_name));
}
Exemple #18
0
/* Errors on user side */
void jxbt_throw_illegal(JNIEnv * env, char *msg)
{
  jxbt_throw_by_name(env, "java/lang/IllegalArgumentException", msg);
}
Exemple #19
0
void jxbt_throw_time_out_failure(JNIEnv* env, const std::string& details)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/TimeoutException", details);
}
Exemple #20
0
void jxbt_throw_jni(JNIEnv* env, const std::string& msg)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/JniException", "Internal or JNI error: " + msg);
}
Exemple #21
0
void jxbt_throw_notbound(JNIEnv* env, const std::string& kind, void* pointer)
{
  jxbt_throw_by_name(env, "org/simgrid/msg/JniException",
                     simgrid::xbt::string_printf("Internal error: %s %p not bound", kind.c_str(), pointer));
}
Exemple #22
0
/* Errors in MSG */
void jxbt_throw_jni(JNIEnv * env, const char *msg)
{
  jxbt_throw_by_name(env,
                     "org/simgrid/msg/JniException",
                     bprintf("Internal or JNI error: %s", msg));
}