Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2023.
[simgrid.git] / src / bindings / java / jmsg.cpp
index bdc6661..9b60f4e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -84,7 +84,10 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_init(JNIEnv* env, jclass, jobjec
 {
   env->GetJavaVM(&__java_vm);
 
-  simgrid::kernel::context::factory_initializer = &simgrid::kernel::context::java_factory;
+  simgrid::kernel::context::ContextFactory::initializer = []() {
+    XBT_INFO("Using regular java threads.");
+    return new simgrid::kernel::context::JavaContextFactory();
+  };
   const _jthrowable* exc                        = env->ExceptionOccurred();
   if (exc) {
     env->ExceptionClear();
@@ -291,9 +294,7 @@ static void java_main(int argc, char* argv[])
   run_jprocess(env, context->jprocess_);
 }
 
-namespace simgrid {
-namespace kernel {
-namespace context {
+namespace simgrid::kernel::context {
 
 /** Run the Java org.simgrid.msg.Process */
 void java_main_jprocess(jobject jprocess)
@@ -305,6 +306,4 @@ void java_main_jprocess(jobject jprocess)
 
   run_jprocess(env, context->jprocess_);
 }
-} // namespace context
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::context