X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b8df87e176f27b25534f27d7e240defa32ca35bc..ac080087b39ef79ff497d3992ff04b3e20fe40b2:/src/bindings/java/jmsg_vm.cpp diff --git a/src/bindings/java/jmsg_vm.cpp b/src/bindings/java/jmsg_vm.cpp index 3fa29e77a3..b917e08303 100644 --- a/src/bindings/java/jmsg_vm.cpp +++ b/src/bindings/java/jmsg_vm.cpp @@ -10,6 +10,7 @@ #include "jxbt_utilities.hpp" #include "simgrid/Exception.hpp" #include "simgrid/plugins/live_migration.h" +#include "src/kernel/context/Context.hpp" #include "src/plugins/vm/VirtualMachineImpl.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java); @@ -150,12 +151,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_nativeMigration(JNIEnv* env, jobj { 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"); + if (not simgrid::ForcefulKillException::try_n_catch([&vm, &host]() { MSG_vm_migrate(vm, host); })) { + XBT_VERB("Caught exception during migration"); + jxbt_throw_host_failure(env, "during migration"); } }