From ad51858fe444dfe10cdf18e9d8e25f7d339164f7 Mon Sep 17 00:00:00 2001 From: mquinson Date: Thu, 2 Dec 2010 16:17:37 +0000 Subject: [PATCH] the supernovae exploded: let's split the archive and move bindings to separate packages git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8902 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- buildtools/Cmake/CompleteInFiles.cmake | 21 - buildtools/Cmake/DefinePackages.cmake | 58 - buildtools/Cmake/MakeJava.cmake | 93 - examples/java/basic/BasicTest.java | 42 - examples/java/basic/FinalizeTask.java | 15 - examples/java/basic/Forwarder.java | 49 - examples/java/basic/Master.java | 42 - examples/java/basic/README | 11 - examples/java/basic/Slave.java | 42 - examples/java/basic/basic.tesh | 75 - examples/java/basic/basic_deployment.xml | 49 - examples/java/basic/basic_platform.xml | 8298 ----------------- examples/java/comm_time/CommTimeTest.java | 36 - examples/java/comm_time/FinalizeTask.java | 15 - examples/java/comm_time/Master.java | 43 - examples/java/comm_time/README | 5 - examples/java/comm_time/Slave.java | 31 - examples/java/comm_time/comm_time.tesh | 90 - .../java/comm_time/comm_time_deployment.xml | 55 - .../java/comm_time/comm_time_platform.xml | 8298 ----------------- examples/java/java_test.mk | 26 - examples/java/ping_pong/PingPongTask.java | 30 - examples/java/ping_pong/PingPongTest.java | 38 - examples/java/ping_pong/README | 2 - examples/java/ping_pong/Receiver.java | 42 - examples/java/ping_pong/Sender.java | 51 - examples/java/ping_pong/ping_pong.tesh | 16 - .../java/ping_pong/ping_pong_deployment.xml | 8 - .../java/ping_pong/ping_pong_platform.xml | 92 - examples/java/runtest | 15 - examples/java/suspend/DreamMaster.java | 39 - examples/java/suspend/LazyGuy.java | 30 - examples/java/suspend/README | 1 - examples/java/suspend/SuspendTest.java | 35 - examples/java/suspend/suspend.tesh | 15 - examples/java/suspend/suspend_deployment.xml | 5 - examples/java/suspend/suspend_platform.xml | 8298 ----------------- src/java/jmsg.c | 1152 --- src/java/jmsg.h | 344 - src/java/jmsg_application_handler.c | 110 - src/java/jmsg_application_handler.h | 21 - src/java/jmsg_host.c | 88 - src/java/jmsg_host.h | 110 - src/java/jmsg_process.c | 216 - src/java/jmsg_process.h | 242 - src/java/jmsg_task.c | 41 - src/java/jmsg_task.h | 78 - src/java/jxbt_utilities.c | 296 - src/java/jxbt_utilities.h | 94 - src/java/simgrid/msg/ApplicationHandler.java | 144 - src/java/simgrid/msg/Host.java | 165 - .../simgrid/msg/HostFailureException.java | 32 - .../simgrid/msg/HostNotFoundException.java | 32 - src/java/simgrid/msg/JniException.java | 35 - src/java/simgrid/msg/Msg.java | 113 - src/java/simgrid/msg/MsgException.java | 42 - src/java/simgrid/msg/MsgNative.java | 428 - src/java/simgrid/msg/NativeException.java | 28 - src/java/simgrid/msg/Process.java | 380 - .../simgrid/msg/ProcessNotFoundException.java | 35 - src/java/simgrid/msg/Sem.java | 35 - src/java/simgrid/msg/Task.java | 223 - .../simgrid/msg/TaskCancelledException.java | 32 - src/java/simgrid/msg/TimeoutException.java | 32 - .../simgrid/msg/TransferFailureException.java | 32 - 65 files changed, 30691 deletions(-) delete mode 100644 buildtools/Cmake/MakeJava.cmake delete mode 100644 examples/java/basic/BasicTest.java delete mode 100644 examples/java/basic/FinalizeTask.java delete mode 100644 examples/java/basic/Forwarder.java delete mode 100644 examples/java/basic/Master.java delete mode 100644 examples/java/basic/README delete mode 100644 examples/java/basic/Slave.java delete mode 100644 examples/java/basic/basic.tesh delete mode 100644 examples/java/basic/basic_deployment.xml delete mode 100644 examples/java/basic/basic_platform.xml delete mode 100644 examples/java/comm_time/CommTimeTest.java delete mode 100644 examples/java/comm_time/FinalizeTask.java delete mode 100644 examples/java/comm_time/Master.java delete mode 100644 examples/java/comm_time/README delete mode 100644 examples/java/comm_time/Slave.java delete mode 100644 examples/java/comm_time/comm_time.tesh delete mode 100644 examples/java/comm_time/comm_time_deployment.xml delete mode 100644 examples/java/comm_time/comm_time_platform.xml delete mode 100644 examples/java/java_test.mk delete mode 100644 examples/java/ping_pong/PingPongTask.java delete mode 100644 examples/java/ping_pong/PingPongTest.java delete mode 100644 examples/java/ping_pong/README delete mode 100644 examples/java/ping_pong/Receiver.java delete mode 100644 examples/java/ping_pong/Sender.java delete mode 100644 examples/java/ping_pong/ping_pong.tesh delete mode 100644 examples/java/ping_pong/ping_pong_deployment.xml delete mode 100644 examples/java/ping_pong/ping_pong_platform.xml delete mode 100755 examples/java/runtest delete mode 100644 examples/java/suspend/DreamMaster.java delete mode 100644 examples/java/suspend/LazyGuy.java delete mode 100644 examples/java/suspend/README delete mode 100644 examples/java/suspend/SuspendTest.java delete mode 100644 examples/java/suspend/suspend.tesh delete mode 100644 examples/java/suspend/suspend_deployment.xml delete mode 100644 examples/java/suspend/suspend_platform.xml delete mode 100644 src/java/jmsg.c delete mode 100644 src/java/jmsg.h delete mode 100644 src/java/jmsg_application_handler.c delete mode 100644 src/java/jmsg_application_handler.h delete mode 100644 src/java/jmsg_host.c delete mode 100644 src/java/jmsg_host.h delete mode 100644 src/java/jmsg_process.c delete mode 100644 src/java/jmsg_process.h delete mode 100644 src/java/jmsg_task.c delete mode 100644 src/java/jmsg_task.h delete mode 100644 src/java/jxbt_utilities.c delete mode 100644 src/java/jxbt_utilities.h delete mode 100644 src/java/simgrid/msg/ApplicationHandler.java delete mode 100644 src/java/simgrid/msg/Host.java delete mode 100644 src/java/simgrid/msg/HostFailureException.java delete mode 100644 src/java/simgrid/msg/HostNotFoundException.java delete mode 100644 src/java/simgrid/msg/JniException.java delete mode 100644 src/java/simgrid/msg/Msg.java delete mode 100644 src/java/simgrid/msg/MsgException.java delete mode 100644 src/java/simgrid/msg/MsgNative.java delete mode 100644 src/java/simgrid/msg/NativeException.java delete mode 100644 src/java/simgrid/msg/Process.java delete mode 100644 src/java/simgrid/msg/ProcessNotFoundException.java delete mode 100644 src/java/simgrid/msg/Sem.java delete mode 100644 src/java/simgrid/msg/Task.java delete mode 100644 src/java/simgrid/msg/TaskCancelledException.java delete mode 100644 src/java/simgrid/msg/TimeoutException.java delete mode 100644 src/java/simgrid/msg/TransferFailureException.java diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index 33be2d13ed..7508c42e7b 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -68,7 +68,6 @@ set(CONTEXT_UCONTEXT 0) SET(CONTEXT_THREADS 0) SET(HAVE_RUBY 0) set(HAVE_LUA 0) -SET(HAVE_JAVA 0) SET(HAVE_TRACING 0) if(enable_tracing) @@ -153,26 +152,6 @@ if(enable_smpi) endif(HAVE_F2C_H) endif(enable_smpi) -#-------------------------------------------------------------------------------------------------- -### Initialize of CONTEXT JAVA - -if(enable_java) - include(FindJava) - include(FindJNI) - if(JAVA_INCLUDE_PATH) - set(HAVE_JNI_H 1) - endif(JAVA_INCLUDE_PATH) - if(JAVA_COMPILE AND JAVA_INCLUDE_PATH AND JAVA_INCLUDE_PATH2) - SET(HAVE_JAVA 1) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${JAVA_INCLUDE_PATH} ") - if(NOT JAVA_INCLUDE_PATH STREQUAL JAVA_INCLUDE_PATH2) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${JAVA_INCLUDE_PATH2} ") - endif(NOT JAVA_INCLUDE_PATH STREQUAL JAVA_INCLUDE_PATH2) - else(JAVA_COMPILE AND JAVA_INCLUDE_PATH AND JAVA_INCLUDE_PATH2) - SET(HAVE_JAVA 0) - endif(JAVA_COMPILE AND JAVA_INCLUDE_PATH AND JAVA_INCLUDE_PATH2) -endif(enable_java) - #-------------------------------------------------------------------------------------------------- ### Initialize of CONTEXT GTNETS if(NOT enable_gtnets OR enable_supernovae) diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index e61b383588..fa800c38ee 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -83,7 +83,6 @@ set(EXTRA_DIST src/amok/amok_modinter.h src/simix/private.h src/simix/smx_context_private.h - src/simix/smx_context_java.h src/smpi/private.h src/smpi/smpi_coll_private.h src/smpi/smpi_mpi_dt_private.h @@ -115,40 +114,6 @@ set(SMPI_SRC src/smpi/smpi_mpi_dt.c ) -set(JMSG_C_SRC - src/simix/smx_context_java.c - src/java/jxbt_utilities.c - src/java/jxbt_utilities.h - src/java/jmsg.c - src/java/jmsg.h - src/java/jmsg_host.c - src/java/jmsg_host.h - src/java/jmsg_process.c - src/java/jmsg_process.h - src/java/jmsg_task.c - src/java/jmsg_task.h - src/java/jmsg_application_handler.c - src/java/jmsg_application_handler.h -) - -set(JMSG_JAVA_SRC - src/java/simgrid/msg/ApplicationHandler.java - src/java/simgrid/msg/Host.java - src/java/simgrid/msg/HostFailureException.java - src/java/simgrid/msg/HostNotFoundException.java - src/java/simgrid/msg/JniException.java - src/java/simgrid/msg/Msg.java - src/java/simgrid/msg/MsgException.java - src/java/simgrid/msg/MsgNative.java - src/java/simgrid/msg/NativeException.java - src/java/simgrid/msg/Process.java - src/java/simgrid/msg/ProcessNotFoundException.java - src/java/simgrid/msg/Sem.java - src/java/simgrid/msg/Task.java - src/java/simgrid/msg/TaskCancelledException.java - src/java/simgrid/msg/TimeoutException.java - src/java/simgrid/msg/TransferFailureException.java -) set(GRAS_RL_SRC src/gras/rl_stubs.c @@ -515,21 +480,6 @@ elseif(${HAVE_LUA}) ) endif(${HAVE_LUA}) -set(EXTRA_DIST - ${EXTRA_DIST} - ${JMSG_JAVA_SRC} -) -if(${HAVE_JAVA}) - set(simgrid_sources - ${simgrid_sources} - ${JMSG_C_SRC} # add the binding support to the library - ) -else(${HAVE_JAVA}) - set(EXTRA_DIST - ${EXTRA_DIST} - ${JMSG_C_SRC} - ) -endif(${HAVE_JAVA}) if(${HAVE_RUBY}) set(simgrid_sources @@ -695,7 +645,6 @@ file(GLOB_RECURSE add_src_files "tools/*CMakeLists.txt" "examples/*.c" "examples/*.cxx" -"examples/*.java" "examples/*.lua" "examples/*.rb" "examples/*CMakeLists.txt" @@ -759,7 +708,6 @@ file(GLOB_RECURSE txt_files "examples/msg/actions/actions_split_p1.txt" "examples/msg/actions/CMakeLists.txt" "examples/msg/migration/migration.deploy" -"examples/java/runtest" "teshsuite/gras/datadesc/datadesc.little32_4" "teshsuite/gras/datadesc/datadesc.little64" "teshsuite/gras/datadesc/datadesc.big32_8" @@ -810,10 +758,6 @@ file(GLOB_RECURSE txt_files "examples/gras/pmm/test_sg_64" "examples/gras/synchro/test_sg_64" "examples/gras/properties/test_sg" -"examples/java/basic/BasicTest" -"examples/java/ping_pong/PingPongTest" -"examples/java/comm_time/CommTimeTest" -"examples/java/suspend/SuspendTest" ) set(txt_files @@ -853,8 +797,6 @@ set(source_to_pack ${XBT_RL_SRC} ${EXTRA_DIST} ${SMPI_SRC} - ${JMSG_C_SRC} - ${JMSG_JAVA_SRC} ${GRAS_RL_SRC} ${XBT_SRC} ${GTNETS_SRC} diff --git a/buildtools/Cmake/MakeJava.cmake b/buildtools/Cmake/MakeJava.cmake deleted file mode 100644 index 8dfa0fb9e9..0000000000 --- a/buildtools/Cmake/MakeJava.cmake +++ /dev/null @@ -1,93 +0,0 @@ -set(JAVA_FILES ${JMSG_JAVA_SRC}) -set(JAVA_CLASSES ${JAVA_FILES}) - -string(REPLACE "src/java/" "${CMAKE_HOME_DIRECTORY}/src/java/" - JAVA_FILES "${JAVA_FILES}") - -string(REPLACE "src/java/simgrid/msg" "${CMAKE_CURRENT_BINARY_DIR}/classes/simgrid/msg" - JAVA_CLASSES "${JAVA_CLASSES}") -string(REPLACE ".java" ".class;" - JAVA_CLASSES "${JAVA_CLASSES}") - - -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/classes/ - COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/classes/") - -# compile all .java files with javac to .class -ADD_CUSTOM_COMMAND( - OUTPUT ${JAVA_CLASSES} - DEPENDS ${JAVA_FILES} ${CMAKE_CURRENT_BINARY_DIR}/classes/ - COMMAND ${JAVA_COMPILE} -d ${CMAKE_CURRENT_BINARY_DIR}/classes/ - -cp ${CMAKE_CURRENT_BINARY_DIR}/classes/ - ${JAVA_FILES} - COMMENT "Compiling java sources of core library..." -) - -ADD_CUSTOM_TARGET(simgrid_java ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/simgrid.jar simgrid) - -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/simgrid.jar - DEPENDS ${JAVA_CLASSES} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes - COMMAND ${JAVA_ARCHIVE} -cvf ${CMAKE_CURRENT_BINARY_DIR}/simgrid.jar . - COMMENT "Building simgrid.jar..." -) - -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/BasicTest.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/FinalizeTask.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/Forwarder.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/Slave.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/Master.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong/PingPongTest.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong/Sender.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong/PingPongTask.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong/Receiver.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time/FinalizeTask.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time/CommTimeTest.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time/Slave.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time/Master.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/suspend/SuspendTest.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/suspend/LazyGuy.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/suspend/DreamMaster.class - - DEPENDS simgrid - ${CMAKE_CURRENT_BINARY_DIR}/simgrid.jar - ${CMAKE_HOME_DIRECTORY}/examples/java/basic/*.java - ${CMAKE_HOME_DIRECTORY}/examples/java/ping_pong/*.java - ${CMAKE_HOME_DIRECTORY}/examples/java/comm_time/*.java - ${CMAKE_HOME_DIRECTORY}/examples/java/suspend/*.java - - COMMENT "Build examples for java" - - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/examples/java/suspend - - COMMAND ${JAVA_COMPILE} -d ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic -cp ${CMAKE_CURRENT_BINARY_DIR}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/java/basic/*.java - COMMAND ${JAVA_COMPILE} -d ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong -cp ${CMAKE_CURRENT_BINARY_DIR}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/java/ping_pong/*.java - COMMAND ${JAVA_COMPILE} -d ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time -cp ${CMAKE_CURRENT_BINARY_DIR}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/java/comm_time/*.java - COMMAND ${JAVA_COMPILE} -d ${CMAKE_CURRENT_BINARY_DIR}/examples/java/suspend -cp ${CMAKE_CURRENT_BINARY_DIR}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/java/suspend/*.java -) - -ADD_CUSTOM_TARGET(simgrid_java_examples ALL - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/BasicTest.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/FinalizeTask.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/Forwarder.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/Slave.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/basic/Master.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong/PingPongTest.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong/Sender.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong/PingPongTask.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/ping_pong/Receiver.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time/FinalizeTask.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time/CommTimeTest.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time/Slave.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/comm_time/Master.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/suspend/SuspendTest.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/suspend/LazyGuy.class - ${CMAKE_CURRENT_BINARY_DIR}/examples/java/suspend/DreamMaster.class -) \ No newline at end of file diff --git a/examples/java/basic/BasicTest.java b/examples/java/basic/BasicTest.java deleted file mode 100644 index e6c6a8f672..0000000000 --- a/examples/java/basic/BasicTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.*; - -public class BasicTest { - - /* This only contains the launcher. If you do nothing more than than you can run - * java simgrid.msg.Msg - * which also contains such a launcher - */ - - public static void main(String[] args) throws NativeException { - - /* initialize the MSG simulation. Must be done before anything else (even logging). */ - Msg.init(args); - - if(args.length == 0) { - Msg.createEnvironment("basic_platform.xml"); - Msg.deployApplication("basic_deployment.xml"); - - } else if (args.length < 2) { - - - Msg.info("Usage : Basic platform_file deployment_file"); - Msg.info("example : Basic basic_platform.xml basic_deployment.xml"); - System.exit(1); - } else { - - /* construct the platform and deploy the application */ - Msg.createEnvironment(args[0]); - Msg.deployApplication(args[1]); - } - - /* execute the simulation. */ - Msg.run(); - } -} diff --git a/examples/java/basic/FinalizeTask.java b/examples/java/basic/FinalizeTask.java deleted file mode 100644 index 3764382617..0000000000 --- a/examples/java/basic/FinalizeTask.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.*; - -public class FinalizeTask extends Task { - public FinalizeTask() { - super("finalize",0,0); - } -} - \ No newline at end of file diff --git a/examples/java/basic/Forwarder.java b/examples/java/basic/Forwarder.java deleted file mode 100644 index 741133f7c9..0000000000 --- a/examples/java/basic/Forwarder.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.*; - -public class Forwarder extends simgrid.msg.Process { - - public void main(String[] args) throws MsgException { - if (args.length < 3) { - Msg.info("Forwarder needs 3 arguments (input mailbox, first output mailbox, last one)"); - Msg.info("Got "+args.length+" instead"); - System.exit(1); - } - int input = Integer.valueOf(args[0]).intValue(); - int firstOutput = Integer.valueOf(args[1]).intValue(); - int lastOutput = Integer.valueOf(args[2]).intValue(); - - int taskCount = 0; - int slavesCount = lastOutput - firstOutput + 1; - Msg.info("Receiving on 'slave_"+input+"'"); - while(true) { - Task task = Task.receive("slave_"+input); - - if (task instanceof FinalizeTask) { - Msg.info("Got a finalize task. Let's forward that we're done."); - - for (int cpt = firstOutput; cpt<=lastOutput; cpt++) { - Task tf = new FinalizeTask(); - tf.send("slave_"+cpt); - } - break; - } - int dest = firstOutput + (taskCount % slavesCount); - - Msg.info("Sending \"" + task.getName() + "\" to \"slave_" + dest + "\""); - task.send("slave_"+dest); - - taskCount++; - } - - - Msg.info("I'm done. See you!"); - } -} - diff --git a/examples/java/basic/Master.java b/examples/java/basic/Master.java deleted file mode 100644 index 021220c85f..0000000000 --- a/examples/java/basic/Master.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Master of a basic master/slave example in Java - * - * Copyright 2006,2007,2010 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. - */ - -import simgrid.msg.*; - -public class Master extends simgrid.msg.Process { - public void main(String[] args) throws MsgException { - if (args.length < 4) { - Msg.info("Master needs 4 arguments"); - System.exit(1); - } - - int tasksCount = Integer.valueOf(args[0]).intValue(); - double taskComputeSize = Double.valueOf(args[1]).doubleValue(); - double taskCommunicateSize = Double.valueOf(args[2]).doubleValue(); - - int slavesCount = Integer.valueOf(args[3]).intValue(); - - Msg.info("Hello! Got "+ slavesCount + " slaves and "+tasksCount+" tasks to process"); - - for (int i = 0; i < tasksCount; i++) { - Task task = new Task("Task_" + i, taskComputeSize, taskCommunicateSize); - //Msg.info("Sending \"" + task.getName()+ "\" to \"slave_" + i % slavesCount + "\""); - task.send("slave_"+(i%slavesCount)); - } - - Msg.info("All tasks have been dispatched. Let's tell everybody the computation is over."); - - for (int i = 0; i < slavesCount; i++) { - FinalizeTask task = new FinalizeTask(); - task.send("slave_"+(i%slavesCount)); - } - - Msg.info("Goodbye now!"); - } -} diff --git a/examples/java/basic/README b/examples/java/basic/README deleted file mode 100644 index 9207911abc..0000000000 --- a/examples/java/basic/README +++ /dev/null @@ -1,11 +0,0 @@ -This is a somehow basic master/slaves example. - -There is 3 kind of processes: - * Master: creates some tasks, and dispatches them to its slaves - * Forwarder: get tasks from master, and dispatch them further - * Slave: get tasks from either master or forwarder, and run them - -At the end of the execution: - - the master sends FinalizeTask to every known slave to stop them - - On reception of FT, forwarders send FT to every slave, and stop. - - On reception of FinalizeTask, slaves stop. \ No newline at end of file diff --git a/examples/java/basic/Slave.java b/examples/java/basic/Slave.java deleted file mode 100644 index d55ae0a224..0000000000 --- a/examples/java/basic/Slave.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.HostFailureException; -import simgrid.msg.Msg; -import simgrid.msg.Task; -import simgrid.msg.TaskCancelledException; -import simgrid.msg.TimeoutException; -import simgrid.msg.TransferFailureException; - -public class Slave extends simgrid.msg.Process { - public void main(String[] args) throws TransferFailureException, HostFailureException, TimeoutException { - if (args.length < 1) { - Msg.info("Slave needs 1 argument (its number)"); - System.exit(1); - } - - int num = Integer.valueOf(args[0]).intValue(); - //Msg.info("Receiving on 'slave_"+num+"'"); - - while(true) { - Task task = Task.receive("slave_"+num); - - if (task instanceof FinalizeTask) { - break; - } - Msg.info("Received \"" + task.getName() + "\". Processing it."); - try { - task.execute(); - } catch (TaskCancelledException e) { - - } - // Msg.info("\"" + task.getName() + "\" done "); - } - - //Msg.info("Received Finalize. I'm done. See you!"); - } -} \ No newline at end of file diff --git a/examples/java/basic/basic.tesh b/examples/java/basic/basic.tesh deleted file mode 100644 index 8bbea2bb62..0000000000 --- a/examples/java/basic/basic.tesh +++ /dev/null @@ -1,75 +0,0 @@ -# compile the example -$ javac -classpath $MSG4JAVA_CLASSPATH$ENV_SEPARATOR. *.java - -# run the basic sample -$ java -classpath $MSG4JAVA_CLASSPATH$ENV_SEPARATOR BasicTest basic_platform.xml basic_deployment.xml -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] hello! -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argc=8 -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argv:5 -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argv:50000 -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argv:10 -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argv:iRMX -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argv:Casavant -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argv:Bousquet -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argv:Soucy -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] argv:Jackson -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Got 5 slave(s) : -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] iRMX -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Casavant -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Bousquet -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Soucy -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Jackson -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Got 5 task to process. -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Sending "Task_0" to "iRMX" -> [Jackson:Forwarder:(2) 0.000000] [jmsg/INFO] hello! -> [Casavant:Forwarder:(3) 0.000000] [jmsg/INFO] hello! -> [iRMX:Slave:(4) 0.000000] [jmsg/INFO] Hello ! -> [Bousquet:Slave:(5) 0.000000] [jmsg/INFO] Hello ! -> [Soucy:Slave:(6) 0.000000] [jmsg/INFO] Hello ! -> [Kuenning:Slave:(7) 0.000000] [jmsg/INFO] Hello ! -> [Browne:Slave:(8) 0.000000] [jmsg/INFO] Hello ! -> [Stephen:Slave:(9) 0.000000] [jmsg/INFO] Hello ! -> [Robert:Slave:(10) 0.000000] [jmsg/INFO] Hello ! -> [Sirois:Slave:(11) 0.000000] [jmsg/INFO] Hello ! -> [Monique:Slave:(12) 0.000000] [jmsg/INFO] Hello ! -> [Jacquelin:Master:(1) 0.234181] [jmsg/INFO] Sending "Task_1" to "Casavant" -> [iRMX:Slave:(4) 0.234181] [jmsg/INFO] Received "Task_0" -> [iRMX:Slave:(4) 0.234181] [jmsg/INFO] Processing "Task_0" -> [iRMX:Slave:(4) 0.234910] [jmsg/INFO] "Task_0" done -> [Jacquelin:Master:(1) 0.338591] [jmsg/INFO] Sending "Task_2" to "Bousquet" -> [Casavant:Forwarder:(3) 0.338591] [jmsg/INFO] Received "Task_1" -> [Casavant:Forwarder:(3) 0.338591] [jmsg/INFO] Sending "Task_1" to "Robert" -> [Jacquelin:Master:(1) 0.416661] [jmsg/INFO] Sending "Task_3" to "Soucy" -> [Bousquet:Slave:(5) 0.416661] [jmsg/INFO] Received "Task_2" -> [Bousquet:Slave:(5) 0.416661] [jmsg/INFO] Processing "Task_2" -> [Bousquet:Slave:(5) 0.417826] [jmsg/INFO] "Task_2" done -> [Robert:Slave:(10) 0.454402] [jmsg/INFO] Received "Task_1" -> [Robert:Slave:(10) 0.454402] [jmsg/INFO] Processing "Task_1" -> [Robert:Slave:(10) 0.454766] [jmsg/INFO] "Task_1" done -> [Jacquelin:Master:(1) 0.527739] [jmsg/INFO] Sending "Task_4" to "Jackson" -> [Soucy:Slave:(6) 0.527739] [jmsg/INFO] Received "Task_3" -> [Soucy:Slave:(6) 0.527739] [jmsg/INFO] Processing "Task_3" -> [Soucy:Slave:(6) 0.528103] [jmsg/INFO] "Task_3" done -> [Jacquelin:Master:(1) 0.593252] [jmsg/INFO] Send completed -> [Jacquelin:Master:(1) 0.593252] [jmsg/INFO] All tasks have been dispatched. Let's tell everybody the computation is over. -> [Jackson:Forwarder:(2) 0.593252] [jmsg/INFO] Received "Task_4" -> [Jackson:Forwarder:(2) 0.593252] [jmsg/INFO] Sending "Task_4" to "Kuenning" -> [Kuenning:Slave:(7) 0.593708] [jmsg/INFO] Received "Task_4" -> [Kuenning:Slave:(7) 0.593708] [jmsg/INFO] Processing "Task_4" -> [Kuenning:Slave:(7) 0.594291] [jmsg/INFO] "Task_4" done -> [iRMX:Slave:(4) 0.827199] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Casavant:Forwarder:(3) 0.931504] [jmsg/INFO] All tasks have been dispatched. Let's tell everybody the computation is over. -> [Bousquet:Slave:(5) 1.009496] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Robert:Slave:(10) 1.047200] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Sirois:Slave:(11) 1.086548] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Soucy:Slave:(6) 1.120464] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Casavant:Forwarder:(3) 1.154764] [jmsg/INFO] I'm done. See you! -> [Monique:Slave:(12) 1.154764] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 1.185911] [jmsg/INFO] Goodbye now! -> [Jackson:Forwarder:(2) 1.185911] [jmsg/INFO] All tasks have been dispatched. Let's tell everybody the computation is over. -> [Kuenning:Slave:(7) 1.186360] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Browne:Slave:(8) 1.325058] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jackson:Forwarder:(2) 1.532781] [jmsg/INFO] I'm done. See you! -> [Stephen:Slave:(9) 1.532781] [jmsg/INFO] Received Finalize. I'm done. See you! - - diff --git a/examples/java/basic/basic_deployment.xml b/examples/java/basic/basic_deployment.xml deleted file mode 100644 index b6195d1c6e..0000000000 --- a/examples/java/basic/basic_deployment.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/java/basic/basic_platform.xml b/examples/java/basic/basic_platform.xml deleted file mode 100644 index 484de26362..0000000000 --- a/examples/java/basic/basic_platform.xml +++ /dev/null @@ -1,8298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/java/comm_time/CommTimeTest.java b/examples/java/comm_time/CommTimeTest.java deleted file mode 100644 index ef31c0baa2..0000000000 --- a/examples/java/comm_time/CommTimeTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2006,2007,2010 The SimGrid Team. All right 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. - */ - - -import simgrid.msg.*; - -public class CommTimeTest { - - /* This only contains the launcher. If you do nothing more than than you can run - * java simgrid.msg.Msg - * which also contains such a launcher - */ - - public static void main(String[] args) throws NativeException { - - /* initialize the MSG simulation. Must be done before anything else (even logging). */ - Msg.init(args); - - if(args.length < 2) { - Msg.info("Usage : CommTime platform_file deployment_file"); - Msg.info("example : CommTime comm_time_platform.xml comm_time_deployment.xml"); - System.exit(1); - } - - /* construct the platform and deploy the application */ - Msg.createEnvironment(args[0]); - Msg.deployApplication(args[1]); - - /* execute the simulation. */ - Msg.run(); - } -} diff --git a/examples/java/comm_time/FinalizeTask.java b/examples/java/comm_time/FinalizeTask.java deleted file mode 100644 index b7878fd75f..0000000000 --- a/examples/java/comm_time/FinalizeTask.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.*; - -public class FinalizeTask extends Task { - public FinalizeTask() { - super("",0,0); - } -} - \ No newline at end of file diff --git a/examples/java/comm_time/Master.java b/examples/java/comm_time/Master.java deleted file mode 100644 index c2bbc5ce8b..0000000000 --- a/examples/java/comm_time/Master.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Master of a basic master/slave example in Java - * - * Copyright 2006,2007,2010 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. - */ - -import simgrid.msg.*; - -public class Master extends simgrid.msg.Process { - public void main(String[] args) throws MsgException { - if (args.length < 4) { - Msg.info("Master needs 4 arguments"); - System.exit(1); - } - - int tasksCount = Integer.valueOf(args[0]).intValue(); - double taskComputeSize = Double.valueOf(args[1]).doubleValue(); - double taskCommunicateSize = Double.valueOf(args[2]).doubleValue(); - - int slavesCount = Integer.valueOf(args[3]).intValue(); - - Msg.info("Hello! Got "+ slavesCount + " slaves and "+tasksCount+" tasks to process"); - - for (int i = 0; i < tasksCount; i++) { - Task task = new Task("Task_" + i, taskComputeSize, taskCommunicateSize); - if (i%1000==0) - Msg.info("Sending \"" + task.getName()+ "\" to \"slave_" + i % slavesCount + "\""); - task.send("slave_"+(i%slavesCount)); - } - - Msg.info("All tasks have been dispatched. Let's tell everybody the computation is over."); - - for (int i = 0; i < slavesCount; i++) { - FinalizeTask task = new FinalizeTask(); - task.send("slave_"+(i%slavesCount)); - } - - Msg.info("Goodbye now!"); - } -} diff --git a/examples/java/comm_time/README b/examples/java/comm_time/README deleted file mode 100644 index 6512acd7fe..0000000000 --- a/examples/java/comm_time/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory is almost exactly the same example than the -master/slave, the only differences are: - * there is no forwarder here - * the outputs are a bit less verbose - * the example give a lot more work to do (this is used for benchmarking) \ No newline at end of file diff --git a/examples/java/comm_time/Slave.java b/examples/java/comm_time/Slave.java deleted file mode 100644 index 539fd34f59..0000000000 --- a/examples/java/comm_time/Slave.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.*; - -public class Slave extends simgrid.msg.Process { - public void main(String[] args) throws MsgException { - if (args.length < 1) { - Msg.info("Slave needs 1 argument (its number)"); - System.exit(1); - } - - int num = Integer.valueOf(args[0]).intValue(); - Msg.info("Receiving on 'slave_"+num+"'"); - - while(true) { - Task task = Task.receive("slave_"+num); - - if (task instanceof FinalizeTask) { - break; - } - task.execute(); - } - - Msg.info("Received Finalize. I'm done. See you!"); - } -} \ No newline at end of file diff --git a/examples/java/comm_time/comm_time.tesh b/examples/java/comm_time/comm_time.tesh deleted file mode 100644 index 36be196da1..0000000000 --- a/examples/java/comm_time/comm_time.tesh +++ /dev/null @@ -1,90 +0,0 @@ -# compile the example -$ javac -classpath $MSG4JAVA_CLASSPATH$ENV_SEPARATOR. *.java - -# run the comm_time sample -$ java -classpath $MSG4JAVA_CLASSPATH$ENV_SEPARATOR CommTimeTest comm_time_platform.xml comm_time_deployment.xml -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Hello i'm the master -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Got 20 slave(s): -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] iRMX -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Bousquet -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Soucy -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Casavant -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Jackson -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Geoff -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Disney -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] McGee -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Gatien -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Laroche -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Tanguay -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Morin -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Ethernet -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Bellemarre -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Harry -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Olivier -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Boucherville -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Pointe_Claire -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Kansas -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] King -> [Jacquelin:Master:(1) 0.000000] [jmsg/INFO] Got 50000 task(s) to process. -> [iRMX:Slave:(2) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Bousquet:Slave:(3) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Soucy:Slave:(4) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Casavant:Slave:(5) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Jackson:Slave:(6) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Geoff:Slave:(7) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Disney:Slave:(8) 0.000000] [jmsg/INFO] Hello i'm a slave -> [McGee:Slave:(9) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Gatien:Slave:(10) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Laroche:Slave:(11) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Tanguay:Slave:(12) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Morin:Slave:(13) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Ethernet:Slave:(14) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Bellemarre:Slave:(15) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Harry:Slave:(16) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Olivier:Slave:(17) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Boucherville:Slave:(18) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Pointe_Claire:Slave:(19) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Kansas:Slave:(20) 0.000000] [jmsg/INFO] Hello i'm a slave -> [King:Slave:(21) 0.000000] [jmsg/INFO] Hello i'm a slave -> [Jacquelin:Master:(1) 5385.510565] [jmsg/INFO] All tasks have been dispatched. Let's tell everybody the computation is over. -> [Jacquelin:Master:(1) 5385.510565] [jmsg/INFO] Finalize host iRMX [0] -> [Jacquelin:Master:(1) 5385.744512] [jmsg/INFO] Finalize host Bousquet [1] -> [iRMX:Slave:(2) 5385.744512] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5385.822504] [jmsg/INFO] Finalize host Soucy [2] -> [Bousquet:Slave:(3) 5385.822504] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5385.933472] [jmsg/INFO] Finalize host Casavant [3] -> [Soucy:Slave:(4) 5385.933472] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.037777] [jmsg/INFO] Finalize host Jackson [4] -> [Casavant:Slave:(5) 5386.037777] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.103224] [jmsg/INFO] Finalize host Geoff [5] -> [Jackson:Slave:(6) 5386.103224] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.103634] [jmsg/INFO] Finalize host Disney [6] -> [Geoff:Slave:(7) 5386.103634] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.243798] [jmsg/INFO] Finalize host McGee [7] -> [Disney:Slave:(8) 5386.243798] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.312081] [jmsg/INFO] Finalize host Gatien [8] -> [McGee:Slave:(9) 5386.312081] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.410039] [jmsg/INFO] Finalize host Laroche [9] -> [Gatien:Slave:(10) 5386.410039] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.548443] [jmsg/INFO] Finalize host Tanguay [10] -> [Laroche:Slave:(11) 5386.548443] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.624602] [jmsg/INFO] Finalize host Morin [11] -> [Tanguay:Slave:(12) 5386.624602] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.767895] [jmsg/INFO] Finalize host Ethernet [12] -> [Morin:Slave:(13) 5386.767895] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.849385] [jmsg/INFO] Finalize host Bellemarre [13] -> [Ethernet:Slave:(14) 5386.849385] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5386.988558] [jmsg/INFO] Finalize host Harry [14] -> [Bellemarre:Slave:(15) 5386.988558] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5387.129807] [jmsg/INFO] Finalize host Olivier [15] -> [Harry:Slave:(16) 5387.129807] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5387.240138] [jmsg/INFO] Finalize host Boucherville [16] -> [Olivier:Slave:(17) 5387.240138] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5387.386104] [jmsg/INFO] Finalize host Pointe_Claire [17] -> [Boucherville:Slave:(18) 5387.386104] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5387.528570] [jmsg/INFO] Finalize host Kansas [18] -> [Pointe_Claire:Slave:(19) 5387.528570] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5387.597140] [jmsg/INFO] Finalize host King [19] -> [Kansas:Slave:(20) 5387.597140] [jmsg/INFO] Received Finalize. I'm done. See you! -> [Jacquelin:Master:(1) 5387.662613] [jmsg/INFO] All finalize messages have been dispatched. Goodbye now! -> [King:Slave:(21) 5387.662613] [jmsg/INFO] Received Finalize. I'm done. See you! \ No newline at end of file diff --git a/examples/java/comm_time/comm_time_deployment.xml b/examples/java/comm_time/comm_time_deployment.xml deleted file mode 100644 index 0afeaa124c..0000000000 --- a/examples/java/comm_time/comm_time_deployment.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/java/comm_time/comm_time_platform.xml b/examples/java/comm_time/comm_time_platform.xml deleted file mode 100644 index 484de26362..0000000000 --- a/examples/java/comm_time/comm_time_platform.xml +++ /dev/null @@ -1,8298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/java/java_test.mk b/examples/java/java_test.mk deleted file mode 100644 index 90a568c6b0..0000000000 --- a/examples/java/java_test.mk +++ /dev/null @@ -1,26 +0,0 @@ -######################### -# How to compile the code -# All this to only get a dumb javac *java... Automake still have issues with java - -JAVAROOT=. - -AM_JAVACFLAGS=-classpath .:$(top_srcdir)/src/simgrid.jar:../../../src/simgrid.jar:.. - - -########################## -# What to do on make check -# We need to rely on an external script (../runtest) because automake adds a ./ in front of the test name -# We need to override LD_LIBRARY_PATH so that the VM finds the libsimgrid4java.so -# We need to override the CLASSPATH to add simgrid.jar and current dir to the picture -# We also need to express dependencies manually (in each test dir) -# Damn... -if HAVE_JAVA - TESTS_ENVIRONMENT=LD_LIBRARY_PATH="$(top_srcdir)/src/.libs:$$LD_LIBRARY_PATH" \ - CLASSPATH=".:../../../src/simgrid.jar:$(top_srcdir)/src/simgrid.jar:$$CLASSPATH" \ - $(srcdir)/../runtest -else - TESTS_ENVIRONMENT=DO_NOT_HAVE_JAVA=1 $(srcdir)/../runtest -endif - -# declare that we must recompile everything before lauching tests -$(TESTS): classnoinst.stamp diff --git a/examples/java/ping_pong/PingPongTask.java b/examples/java/ping_pong/PingPongTask.java deleted file mode 100644 index 79fa7d2cd7..0000000000 --- a/examples/java/ping_pong/PingPongTask.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.*; - -public class PingPongTask extends Task { - - private double timeVal; - - public PingPongTask() throws NativeException { - this.timeVal = 0; - } - - public PingPongTask(String name, double computeDuration, double messageSize) throws NativeException { - super(name,computeDuration,messageSize); - } - - public void setTime(double timeVal){ - this.timeVal = timeVal; - } - - public double getTime() { - return this.timeVal; - } -} - \ No newline at end of file diff --git a/examples/java/ping_pong/PingPongTest.java b/examples/java/ping_pong/PingPongTest.java deleted file mode 100644 index 48c86b13b0..0000000000 --- a/examples/java/ping_pong/PingPongTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * $Id$ - * - * Copyright 2006,2007 Martin Quinson, Malek Cherier - * 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. - */ - -import simgrid.msg.*; - -public class PingPongTest { - - /* This only contains the launcher. If you do nothing more than than you can run - * java simgrid.msg.Msg - * which also contains such a launcher - */ - - public static void main(String[] args) throws NativeException { - - /* initialize the MSG simulation. Must be done before anything else (even logging). */ - Msg.init(args); - - if(args.length < 2) { - Msg.info("Usage : PingPong platform_file deployment_file"); - Msg.info("example : PingPong ping_pong_platform.xml ping_pong_deployment.xml"); - System.exit(1); - } - - /* construct the platform and deploy the application */ - Msg.createEnvironment(args[0]); - Msg.deployApplication(args[1]); - - /* execute the simulation. */ - Msg.run(); - } -} diff --git a/examples/java/ping_pong/README b/examples/java/ping_pong/README deleted file mode 100644 index aa16de9c89..0000000000 --- a/examples/java/ping_pong/README +++ /dev/null @@ -1,2 +0,0 @@ -This is a stupid ping/pong example. The processes exchange a simple -task and time them. \ No newline at end of file diff --git a/examples/java/ping_pong/Receiver.java b/examples/java/ping_pong/Receiver.java deleted file mode 100644 index 9603a76a82..0000000000 --- a/examples/java/ping_pong/Receiver.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * $Id$ - * - * Copyright 2006,2007 Martin Quinson, Malek Cherier - * 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. - */ - -import simgrid.msg.*; - -public class Receiver extends simgrid.msg.Process { - - final double commSizeLat = 1; - final double commSizeBw = 100000000; - - public void main(String[] args) throws MsgException { - - Msg.info("hello!"); - double communicationTime=0; - - double time = Msg.getClock(); - - Msg.info("try to get a task"); - - PingPongTask task = (PingPongTask)Task.receive(getHost().getName()); - double timeGot = Msg.getClock(); - double timeSent = task.getTime(); - - Msg.info("Got at time "+ timeGot); - Msg.info("Was sent at time "+timeSent); - time=timeSent; - - communicationTime=timeGot - time; - Msg.info("Communication time : " + communicationTime); - - Msg.info(" --- bw "+ commSizeBw/communicationTime + " ----"); - - Msg.info("goodbye!"); - } -} \ No newline at end of file diff --git a/examples/java/ping_pong/Sender.java b/examples/java/ping_pong/Sender.java deleted file mode 100644 index 17f2dfd267..0000000000 --- a/examples/java/ping_pong/Sender.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Sender of basic ping/pong example - * - * Copyright 2006,2007,2010 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. - */ - -import simgrid.msg.*; - -public class Sender extends simgrid.msg.Process { - - private final double commSizeLat = 1; - final double commSizeBw = 100000000; - - public void main(String[] args) throws MsgException { - - Msg.info("hello!"); - - int hostCount = args.length; - - Msg.info("host count: " + hostCount); - String mailboxes[] = new String[hostCount]; - double time; - double computeDuration = 0; - PingPongTask task; - - for(int pos = 0; pos < args.length ; pos++) { - try { - mailboxes[pos] = Host.getByName(args[pos]).getName(); - } catch (HostNotFoundException e) { - Msg.info("Invalid deployment file: " + e.toString()); - System.exit(1); - } - } - - for (int pos = 0; pos < hostCount; pos++) { - time = Msg.getClock(); - - Msg.info("sender time: " + time); - - task = new PingPongTask("no name",computeDuration,commSizeLat); - task.setTime(time); - - task.send(mailboxes[pos]); - } - - Msg.info("goodbye!"); - } -} \ No newline at end of file diff --git a/examples/java/ping_pong/ping_pong.tesh b/examples/java/ping_pong/ping_pong.tesh deleted file mode 100644 index dd53f02b34..0000000000 --- a/examples/java/ping_pong/ping_pong.tesh +++ /dev/null @@ -1,16 +0,0 @@ -# compile the example -$ javac -classpath $MSG4JAVA_CLASSPATH$ENV_SEPARATOR. *.java - -# run the comm_time sample -$ java -classpath $MSG4JAVA_CLASSPATH$ENV_SEPARATOR PingPongTest ping_pong_platform.xml ping_pong_deployment.xml -> [Inmos:Sender:(1) 0.000000] [jmsg/INFO] hello! -> [Inmos:Sender:(1) 0.000000] [jmsg/INFO] host count : 1 -> [Inmos:Sender:(1) 0.000000] [jmsg/INFO] sender time : 0.0 -> [Bellevue:Receiver:(2) 0.000000] [jmsg/INFO] hello! -> [Bellevue:Receiver:(2) 0.000000] [jmsg/INFO] try to get a task -> [Inmos:Sender:(1) 0.001462] [jmsg/INFO] goodbye! -> [Bellevue:Receiver:(2) 0.001462] [jmsg/INFO] Got at time 0.0014616631517 -> [Bellevue:Receiver:(2) 0.001462] [jmsg/INFO] Was sent at time 0.0 -> [Bellevue:Receiver:(2) 0.001462] [jmsg/INFO] Communication time : 0.0014616631517 -> [Bellevue:Receiver:(2) 0.001462] [jmsg/INFO] --- bw 6.841521583389041E10 ---- -> [Bellevue:Receiver:(2) 0.001462] [jmsg/INFO] goodbye! \ No newline at end of file diff --git a/examples/java/ping_pong/ping_pong_deployment.xml b/examples/java/ping_pong/ping_pong_deployment.xml deleted file mode 100644 index e4600d36ae..0000000000 --- a/examples/java/ping_pong/ping_pong_deployment.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/examples/java/ping_pong/ping_pong_platform.xml b/examples/java/ping_pong/ping_pong_platform.xml deleted file mode 100644 index 246f1f2253..0000000000 --- a/examples/java/ping_pong/ping_pong_platform.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/java/runtest b/examples/java/runtest deleted file mode 100755 index 98d65c0dd2..0000000000 --- a/examples/java/runtest +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh - -if test "x$DO_NOT_HAVE_JAVA" = x1 ; then - exit 77 -fi - -t=`basename $1 .class` - -# uncomment this when JNI becomes mad -# options="-verbose:jni -Xcheck:jni " - -echo "(LD_LIBRARY_PATH=$LD_LIBRARY_PATH)" -echo "(CLASSPATH=$CLASSPATH)" -echo java $options $t *platform.xml *deployment.xml -java $options $t *platform.xml *deployment.xml diff --git a/examples/java/suspend/DreamMaster.java b/examples/java/suspend/DreamMaster.java deleted file mode 100644 index c548d9a857..0000000000 --- a/examples/java/suspend/DreamMaster.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * $Id$ - * - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.*; - -public class DreamMaster extends simgrid.msg.Process { - - public void main(String[] args) throws MsgException { - Msg.info("Hello !"); - Msg.info("Let's create a lazy guy."); - - try { - Host currentHost = Host.currentHost(); - Msg.info("Current hostname: " + currentHost.getName()); - - LazyGuy lazy = new LazyGuy(currentHost,"LazyGuy"); - Msg.info("Let's wait a little bit..."); - - simgrid.msg.Process.waitFor(10.0); - - Msg.info("Let's wake the lazy guy up! >:) "); - lazy.restart(); - - } catch(HostNotFoundException e) { - System.err.println(e); - System.exit(1); - } - - //lazy.migrate(currentHost); - - Msg.info("OK, goodbye now."); - } -} \ No newline at end of file diff --git a/examples/java/suspend/LazyGuy.java b/examples/java/suspend/LazyGuy.java deleted file mode 100644 index e31bae0ba3..0000000000 --- a/examples/java/suspend/LazyGuy.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2006,2007,2010. 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. - */ - -import simgrid.msg.*; - -public class LazyGuy extends simgrid.msg.Process { - public LazyGuy() { - super(); - } - - public LazyGuy(Host host,String name) throws HostNotFoundException, NativeException - { - super(host,name,null); - } - - - public void main(String[] args) throws NativeException { - Msg.info("Hello !"); - - Msg.info("Nobody's watching me ? Let's go to sleep."); - pause(); - - Msg.info("Uuuh ? Did somebody call me ?"); - Msg.info("Mmmh, goodbye now."); - } -} \ No newline at end of file diff --git a/examples/java/suspend/README b/examples/java/suspend/README deleted file mode 100644 index e7d4d54ca5..0000000000 --- a/examples/java/suspend/README +++ /dev/null @@ -1 +0,0 @@ -A simple example of the functions to stop and resume a process. \ No newline at end of file diff --git a/examples/java/suspend/SuspendTest.java b/examples/java/suspend/SuspendTest.java deleted file mode 100644 index 60acfd160a..0000000000 --- a/examples/java/suspend/SuspendTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * $Id$ - * - * Copyright 2006,2007 Martin Quinson, Malek Cherier - * 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. - */ - - -import simgrid.msg.*; - -public class SuspendTest { - - public static void main(String[] args) throws NativeException { - - /* initialize the MSG simulation. Must be done before anything else (even logging). */ - Msg.init(args); - - if(args.length < 2) { - - Msg.info("Usage : Suspend platform_file deployment_file"); - Msg.info("example : Suspend msg_test_suspend_platform.xml msg_test_suspend_deployment.xml"); - System.exit(1); - } - - /* construct the platform and deploy the application */ - Msg.createEnvironment(args[0]); - Msg.deployApplication(args[1]); - - /* execute the simulation. */ - Msg.run(); - } -} diff --git a/examples/java/suspend/suspend.tesh b/examples/java/suspend/suspend.tesh deleted file mode 100644 index 000a4492f3..0000000000 --- a/examples/java/suspend/suspend.tesh +++ /dev/null @@ -1,15 +0,0 @@ -# compile the example -$ javac -classpath $MSG4JAVA_CLASSPATH$ENV_SEPARATOR. *.java - -# run the comm_time sample -$ java -classpath $MSG4JAVA_CLASSPATH$ENV_SEPARATOR SuspendTest suspend_platform.xml suspend_deployment.xml -> [Jacquelin:DreamMaster:(1) 0.000000] [jmsg/INFO] Hello ! -> [Jacquelin:DreamMaster:(1) 0.000000] [jmsg/INFO] Let's create a lazy guy. -> [Jacquelin:DreamMaster:(1) 0.000000] [jmsg/INFO] Current host name : Jacquelin -> [Jacquelin:DreamMaster:(1) 0.000000] [jmsg/INFO] Let's wait a little bit... -> [Jacquelin:LazyGuy:(2) 0.000000] [jmsg/INFO] Hello ! -> [Jacquelin:LazyGuy:(2) 0.000000] [jmsg/INFO] Nobody's watching me ? Let's go to sleep. -> [Jacquelin:DreamMaster:(1) 10.000000] [jmsg/INFO] Let's wake the lazy guy up! >:) -> [Jacquelin:DreamMaster:(1) 10.000000] [jmsg/INFO] OK, goodbye now. -> [Jacquelin:LazyGuy:(2) 10.000000] [jmsg/INFO] Uuuh ? Did somebody call me ? -> [Jacquelin:LazyGuy:(2) 10.000000] [jmsg/INFO] Mmmh, goodbye now. \ No newline at end of file diff --git a/examples/java/suspend/suspend_deployment.xml b/examples/java/suspend/suspend_deployment.xml deleted file mode 100644 index 2bfd68e6c0..0000000000 --- a/examples/java/suspend/suspend_deployment.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/examples/java/suspend/suspend_platform.xml b/examples/java/suspend/suspend_platform.xml deleted file mode 100644 index 484de26362..0000000000 --- a/examples/java/suspend/suspend_platform.xml +++ /dev/null @@ -1,8298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/java/jmsg.c b/src/java/jmsg.c deleted file mode 100644 index 57367ff560..0000000000 --- a/src/java/jmsg.c +++ /dev/null @@ -1,1152 +0,0 @@ -/* Java Wrappers to the MSG API. */ - -/* Copyright (c) 2007, 2008, 2009, 2010. 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. */ - -#include "msg/msg.h" -#include "msg/private.h" -#include "simix/private.h" -#include "simix/smx_context_java.h" - -#include "jmsg_process.h" -#include "jmsg_host.h" -#include "jmsg_task.h" -#include "jmsg_application_handler.h" -#include "jxbt_utilities.h" - -#include "jmsg.h" -#include "msg/mailbox.h" -#include "surf/surfxml_parse.h" - -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg); - -static JavaVM *__java_vm = NULL; - -static jobject native_to_java_process(m_process_t process); - -JavaVM *get_java_VM(void) -{ - return __java_vm; -} - -JNIEnv *get_current_thread_env(void) -{ - JNIEnv *env; - - (*__java_vm)->AttachCurrentThread(__java_vm, (void **) &env, NULL); - - return env; -} - -static jobject native_to_java_process(m_process_t process) -{ - return ((smx_ctx_java_t) - (process->simdata->s_process->context))->jprocess; -} - -/* - * The MSG process connected functions implementation. - */ - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processCreate(JNIEnv * env, jclass cls, - jobject jprocess_arg, - jobject jhost) -{ - jobject jprocess; /* the global reference to the java process instance */ - jstring jname; /* the name of the java process instance */ - const char *name; /* the C name of the process */ - m_process_t process; /* the native process to create */ - char alias[MAX_ALIAS_NAME + 1] = { 0 }; - msg_mailbox_t mailbox; - - DEBUG4 - ("Java_simgrid_msg_MsgNative_processCreate(env=%p,cls=%p,jproc=%p,jhost=%p)", - env, cls, jprocess_arg, jhost); - /* get the name of the java process */ - jname = jprocess_get_name(jprocess_arg, env); - - if (!jname) { - jxbt_throw_null(env, - xbt_strdup - ("Internal error: Process name cannot be NULL")); - return; - } - - /* allocate the data of the simulation */ - process = xbt_new0(s_m_process_t, 1); - process->simdata = xbt_new0(s_simdata_process_t, 1); - - /* create a global java process instance */ - jprocess = jprocess_new_global_ref(jprocess_arg, env); - - if (!jprocess) { - free(process->simdata); - free(process); - jxbt_throw_jni(env, "Can't get a global ref to the java process"); - return; - } - - /* bind the java process instance to the native process */ - jprocess_bind(jprocess, process, env); - - /* build the C name of the process */ - name = (*env)->GetStringUTFChars(env, jname, 0); - process->name = xbt_strdup(name); - (*env)->ReleaseStringUTFChars(env, jname, name); - - process->simdata->m_host = jhost_get_native(env, jhost); - - - if (!(process->simdata->m_host)) { /* not binded */ - free(process->simdata); - free(process->data); - free(process); - jxbt_throw_notbound(env, "host", jhost); - return; - } - process->simdata->PID = msg_global->PID++; - - /* create a new context */ - DEBUG8 - ("fill in process %s/%s (pid=%d) %p (sd=%p, host=%p, host->sd=%p); env=%p", - process->name, process->simdata->m_host->name, - process->simdata->PID, process, process->simdata, - process->simdata->m_host, process->simdata->m_host->simdata, env); - - process->simdata->s_process = - SIMIX_process_create(process->name, (xbt_main_func_t) jprocess, - /*data */ (void *) process, - process->simdata->m_host->simdata-> - smx_host->name, 0, NULL, NULL); - - DEBUG1("context created (s_process=%p)", process->simdata->s_process); - - - if (SIMIX_process_self()) { /* someone created me */ - process->simdata->PPID = - MSG_process_get_PID(SIMIX_process_self()->data); - } else { - process->simdata->PPID = -1; - } - - process->simdata->last_errno = MSG_OK; - - /* add the process to the list of the processes of the simulation */ - xbt_fifo_unshift(msg_global->process_list, process); - - sprintf(alias, "%s:%s", - (process->simdata->m_host->simdata->smx_host)->name, - process->name); - - mailbox = MSG_mailbox_new(alias); - -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processSuspend(JNIEnv * env, jclass cls, - jobject jprocess) -{ - m_process_t process = jprocess_to_native_process(jprocess, env); - - if (!process) { - jxbt_throw_notbound(env, "process", jprocess); - return; - } - - /* try to suspend the process */ - MSG_error_t rv = MSG_process_suspend(process); - - jxbt_check_res("MSG_process_suspend()", rv, MSG_OK, - bprintf("unexpected error , please report this bug")); - -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processResume(JNIEnv * env, jclass cls, - jobject jprocess) -{ - m_process_t process = jprocess_to_native_process(jprocess, env); - - if (!process) { - jxbt_throw_notbound(env, "process", jprocess); - return; - } - - /* try to resume the process */ - MSG_error_t rv = MSG_process_resume(process); - - jxbt_check_res("MSG_process_resume()", rv, MSG_OK, - bprintf("unexpected error , please report this bug")); -} - -JNIEXPORT jboolean JNICALL -Java_simgrid_msg_MsgNative_processIsSuspended(JNIEnv * env, jclass cls, - jobject jprocess) -{ - m_process_t process = jprocess_to_native_process(jprocess, env); - - if (!process) { - jxbt_throw_notbound(env, "process", jprocess); - return 0; - } - - /* true is the process is suspended, false otherwise */ - return (jboolean) MSG_process_is_suspended(process); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processKill(JNIEnv * env, jclass cls, - jobject jprocess) -{ - /* get the native instances from the java ones */ - m_process_t process = jprocess_to_native_process(jprocess, env); - - if (!process) { - jxbt_throw_notbound(env, "process", jprocess); - return; - } - - /* delete the global reference */ - jprocess_delete_global_ref(native_to_java_process(process), env); - - /* kill the native process (this wrapper is call by the destructor of the java - * process instance) - */ - MSG_process_kill(process); -} - -JNIEXPORT jobject JNICALL -Java_simgrid_msg_MsgNative_processGetHost(JNIEnv * env, jclass cls, - jobject jprocess) -{ - /* get the native instances from the java ones */ - m_process_t process = jprocess_to_native_process(jprocess, env); - m_host_t host; - - if (!process) { - jxbt_throw_notbound(env, "process", jprocess); - return NULL; - } - - host = MSG_process_get_host(process); - - if (!MSG_host_get_data(host)) { - jxbt_throw_jni(env, "MSG_process_get_host() failed"); - return NULL; - } - - /* return the global reference to the java host instance */ - return (jobject) MSG_host_get_data(host); - -} - -JNIEXPORT jobject JNICALL -Java_simgrid_msg_MsgNative_processFromPID(JNIEnv * env, jclass cls, - jint PID) -{ - m_process_t process = MSG_process_from_PID(PID); - - if (!process) { - jxbt_throw_process_not_found(env, bprintf("PID = %d",(int) PID)); - return NULL; - } - - if (!native_to_java_process(process)) { - jxbt_throw_jni(env, "SIMIX_process_get_jprocess() failed"); - return NULL; - } - - return (jobject) (native_to_java_process(process)); -} - - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_processGetPID(JNIEnv * env, jclass cls, - jobject jprocess) -{ - m_process_t process = jprocess_to_native_process(jprocess, env); - - if (!process) { - jxbt_throw_notbound(env, "process", jprocess); - return 0; - } - - return (jint) MSG_process_get_PID(process); -} - - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_processGetPPID(JNIEnv * env, jclass cls, - jobject jprocess) -{ - m_process_t process = jprocess_to_native_process(jprocess, env); - - if (!process) { - jxbt_throw_notbound(env, "process", jprocess); - return 0; - } - - return (jint) MSG_process_get_PPID(process); -} - -JNIEXPORT jobject JNICALL -Java_simgrid_msg_MsgNative_processSelf(JNIEnv * env, jclass cls) -{ - m_process_t process = MSG_process_self(); - jobject jprocess; - - if (!process) { - jxbt_throw_jni(env, xbt_strdup("MSG_process_self() failed")); - return NULL; - } - - jprocess = native_to_java_process(process); - - if (!jprocess) - jxbt_throw_jni(env, xbt_strdup("SIMIX_process_get_jprocess() failed")); - - return jprocess; -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processChangeHost(JNIEnv * env, jclass cls, - jobject jhost) -{ - m_host_t host = jhost_get_native(env, jhost); - - if (!host) { - jxbt_throw_notbound(env, "host", jhost); - return; - } - - /* 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, - bprintf("unexpected error , please report this bug")); - -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processWaitFor(JNIEnv * env, jclass cls, - jdouble seconds) -{ - MSG_error_t rv = MSG_process_sleep((double) seconds); - - jxbt_check_res("MSG_process_sleep()", rv, MSG_HOST_FAILURE, - bprintf("while process was waiting for %f seconds", - (double) seconds)); - -} - - -/*************************************************************************************** - * The MSG host connected functions implementation. * - ***************************************************************************************/ - -JNIEXPORT jobject JNICALL -Java_simgrid_msg_MsgNative_hostGetByName(JNIEnv * env, jclass cls, - jstring jname) -{ - m_host_t host; /* native host */ - jobject jhost; /* global reference to the java host instance returned */ - - /* get the C string from the java string */ - const char *name = (*env)->GetStringUTFChars(env, jname, 0); - - /* get the host by name (the hosts are created during the grid resolution) */ - host = MSG_get_host_by_name(name); - DEBUG2("MSG gave %p as native host (simdata=%p)", host, host->simdata); - - (*env)->ReleaseStringUTFChars(env, jname, name); - - if (!host) { /* invalid name */ - jxbt_throw_host_not_found(env, name); - return NULL; - } - - if (!MSG_host_get_data(host)) { /* native host not associated yet with java host */ - - /* instanciate a new java host */ - jhost = jhost_new_instance(env); - - if (!jhost) { - jxbt_throw_jni(env, "java host instantiation failed"); - return NULL; - } - - /* get a global reference to the newly created host */ - jhost = jhost_ref(env, jhost); - - if (!jhost) { - jxbt_throw_jni(env, "new global ref allocation failed"); - return NULL; - } - - /* bind the java host and the native host */ - jhost_bind(jhost, host, env); - - /* the native host data field is set with the global reference to the - * java host returned by this function - */ - MSG_host_set_data(host, (void *) jhost); - } - - /* return the global reference to the java host instance */ - return (jobject) MSG_host_get_data(host); -} - -JNIEXPORT jstring JNICALL -Java_simgrid_msg_MsgNative_hostGetName(JNIEnv * env, jclass cls, - jobject jhost) -{ - m_host_t host = jhost_get_native(env, jhost); - - if (!host) { - jxbt_throw_notbound(env, "host", jhost); - return NULL; - } - - return (*env)->NewStringUTF(env, MSG_host_get_name(host)); -} - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_hostGetNumber(JNIEnv * env, jclass cls) -{ - return (jint) MSG_get_host_number(); -} - -JNIEXPORT jobject JNICALL -Java_simgrid_msg_MsgNative_hostSelf(JNIEnv * env, jclass cls) -{ - jobject jhost; - - m_host_t host = MSG_host_self(); - - if (!MSG_host_get_data(host)) { - /* the native host not yet associated with the java host instance */ - - /* instanciate a new java host instance */ - jhost = jhost_new_instance(env); - - if (!jhost) { - jxbt_throw_jni(env, "java host instantiation failed"); - return NULL; - } - - /* get a global reference to the newly created host */ - jhost = jhost_ref(env, jhost); - - if (!jhost) { - jxbt_throw_jni(env, "global ref allocation failed"); - return NULL; - } - - /* Bind & store it */ - jhost_bind(jhost, host, env); - MSG_host_set_data(host, (void *) jhost); - } else { - jhost = (jobject) MSG_host_get_data(host); - } - - return jhost; -} - -JNIEXPORT jdouble JNICALL -Java_simgrid_msg_MsgNative_hostGetSpeed(JNIEnv * env, jclass cls, - jobject jhost) -{ - m_host_t host = jhost_get_native(env, jhost); - - if (!host) { - jxbt_throw_notbound(env, "host", jhost); - return -1; - } - - return (jdouble) MSG_get_host_speed(host); -} - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_hostGetLoad(JNIEnv * env, jclass cls, - jobject jhost) -{ - m_host_t host = jhost_get_native(env, jhost); - - if (!host) { - jxbt_throw_notbound(env, "host", jhost); - return -1; - } - - return (jint) MSG_get_host_msgload(host); -} - - -JNIEXPORT jboolean JNICALL -Java_simgrid_msg_MsgNative_hostIsAvail(JNIEnv * env, jclass cls, - jobject jhost) -{ - m_host_t host = jhost_get_native(env, jhost); - - if (!host) { - jxbt_throw_notbound(env, "host", jhost); - return 0; - } - - return (jboolean) MSG_host_is_avail(host); -} - - -/*************************************************************************************** - * The MSG task connected functions implementation. * - ***************************************************************************************/ - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_taskCreate(JNIEnv * env, jclass cls, - jobject jtask, jstring jname, - jdouble jcomputeDuration, - jdouble jmessageSize) -{ - m_task_t task; /* the native task to create */ - const char *name = NULL; /* the name of the task */ - - if (jcomputeDuration < 0) { - jxbt_throw_illegal(env, - bprintf - ("Task ComputeDuration (%f) cannot be negative", - (double) jcomputeDuration)); - return; - } - - if (jmessageSize < 0) { - jxbt_throw_illegal(env, - bprintf("Task MessageSize (%f) cannot be negative", - (double) jmessageSize)); - return; - } - - if (jname) { - /* get the C string from the java string */ - name = (*env)->GetStringUTFChars(env, jname, 0); - } - - - /* create the task */ - task = - MSG_task_create(name, (double) jcomputeDuration, - (double) jmessageSize, NULL); - - if (jname) - (*env)->ReleaseStringUTFChars(env, jname, name); - - /* bind & store the task */ - jtask_bind(jtask, task, env); - MSG_task_set_data(task, jtask); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_parallel_taskCreate(JNIEnv * env, jclass cls, - jobject jtask, - jstring jname, - jobjectArray jhosts, - jdoubleArray - jcomputeDurations_arg, - jdoubleArray - jmessageSizes_arg) -{ - - m_task_t task; /* the native parallel task to create */ - const char *name; /* the name of the task */ - int host_count; - m_host_t *hosts; - double *computeDurations; - double *messageSizes; - jdouble *jcomputeDurations; - jdouble *jmessageSizes; - - jobject jhost; - int index; - - - if (!jcomputeDurations_arg) { - jxbt_throw_null(env, - xbt_strdup - ("Parallel task compute durations cannot be null")); - return; - } - - if (!jmessageSizes_arg) { - jxbt_throw_null(env, - xbt_strdup - ("Parallel task message sizes cannot be null")); - return; - } - - if (!jname) { - jxbt_throw_null(env, xbt_strdup("Parallel task name cannot be null")); - return; - } - - host_count = (int) (*env)->GetArrayLength(env, jhosts); - - - hosts = xbt_new0(m_host_t, host_count); - computeDurations = xbt_new0(double, host_count); - messageSizes = xbt_new0(double, host_count * host_count); - - jcomputeDurations = - (*env)->GetDoubleArrayElements(env, jcomputeDurations_arg, 0); - jmessageSizes = - (*env)->GetDoubleArrayElements(env, jmessageSizes_arg, 0); - - for (index = 0; index < host_count; index++) { - jhost = (*env)->GetObjectArrayElement(env, jhosts, index); - hosts[index] = jhost_get_native(env, jhost); - computeDurations[index] = jcomputeDurations[index]; - } - for (index = 0; index < host_count * host_count; index++) { - messageSizes[index] = jmessageSizes[index]; - } - - (*env)->ReleaseDoubleArrayElements(env, jcomputeDurations_arg, - jcomputeDurations, 0); - (*env)->ReleaseDoubleArrayElements(env, jmessageSizes_arg, jmessageSizes, - 0); - - - /* get the C string from the java string */ - name = (*env)->GetStringUTFChars(env, jname, 0); - - task = - MSG_parallel_task_create(name, host_count, hosts, computeDurations, - messageSizes, NULL); - - (*env)->ReleaseStringUTFChars(env, jname, name); - - /* associate the java task object and the native task */ - jtask_bind(jtask, task, env); - - MSG_task_set_data(task, (void *) jtask); - - if (!MSG_task_get_data(task)) - jxbt_throw_jni(env, "global ref allocation failed"); -} - -JNIEXPORT jobject JNICALL -Java_simgrid_msg_MsgNative_taskGetSender(JNIEnv * env, jclass cls, - jobject jtask) -{ - m_process_t process; - - m_task_t task = jtask_to_native_task(jtask, env); - - if (!task) { - jxbt_throw_notbound(env, "task", jtask); - return NULL; - } - - process = MSG_task_get_sender(task); - return (jobject) native_to_java_process(process); -} - -JNIEXPORT jobject JNICALL -Java_simgrid_msg_MsgNative_taskGetSource(JNIEnv * env, jclass cls, - jobject jtask) -{ - m_host_t host; - m_task_t task = jtask_to_native_task(jtask, env); - - if (!task) { - jxbt_throw_notbound(env, "task", jtask); - return NULL; - } - - host = MSG_task_get_source(task); - - if (!MSG_host_get_data(host)) { - jxbt_throw_jni(env, "MSG_task_get_source() failed"); - return NULL; - } - - return (jobject) MSG_host_get_data(host); -} - - -JNIEXPORT jstring JNICALL -Java_simgrid_msg_MsgNative_taskGetName(JNIEnv * env, jclass cls, - jobject jtask) -{ - m_task_t task = jtask_to_native_task(jtask, env); - - if (!task) { - jxbt_throw_notbound(env, "task", jtask); - return NULL; - } - - return (*env)->NewStringUTF(env, MSG_task_get_name(task)); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_taskCancel(JNIEnv * env, jclass cls, - jobject jtask) -{ - m_task_t ptask = jtask_to_native_task(jtask, env); - - if (!ptask) { - jxbt_throw_notbound(env, "task", jtask); - return; - } - - MSG_error_t rv = MSG_task_cancel(ptask); - - jxbt_check_res("MSG_task_cancel()", rv, MSG_OK, - bprintf("unexpected error , please report this bug")); -} - -JNIEXPORT jdouble JNICALL -Java_simgrid_msg_MsgNative_taskGetComputeDuration(JNIEnv * env, jclass cls, - jobject jtask) -{ - m_task_t ptask = jtask_to_native_task(jtask, env); - - if (!ptask) { - jxbt_throw_notbound(env, "task", jtask); - return -1; - } - return (jdouble) MSG_task_get_compute_duration(ptask); -} - -JNIEXPORT jdouble JNICALL -Java_simgrid_msg_MsgNative_taskGetRemainingDuration(JNIEnv * env, - jclass cls, - jobject jtask) -{ - m_task_t ptask = jtask_to_native_task(jtask, env); - - if (!ptask) { - jxbt_throw_notbound(env, "task", jtask); - return -1; - } - return (jdouble) MSG_task_get_remaining_computation(ptask); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_taskSetPriority(JNIEnv * env, jclass cls, - jobject jtask, jdouble priority) -{ - m_task_t task = jtask_to_native_task(jtask, env); - - if (!task) { - jxbt_throw_notbound(env, "task", jtask); - return; - } - MSG_task_set_priority(task, (double) priority); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_taskDestroy(JNIEnv * env, jclass cls, - jobject jtask_arg) -{ - - /* get the native task */ - m_task_t task = jtask_to_native_task(jtask_arg, env); - jobject jtask; - - if (!task) { - jxbt_throw_notbound(env, "task", task); - return; - } - jtask = (jobject) MSG_task_get_data(task); - - MSG_error_t rv = MSG_task_destroy(task); - - jxbt_check_res("MSG_task_destroy()", rv, MSG_OK, - bprintf("unexpected error , please report this bug")); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_taskExecute(JNIEnv * env, jclass cls, - jobject jtask) -{ - m_task_t task = jtask_to_native_task(jtask, env); - - if (!task) { - jxbt_throw_notbound(env, "task", jtask); - return; - } - - MSG_error_t rv = MSG_task_execute(task); - - jxbt_check_res("MSG_task_execute()", rv, - MSG_HOST_FAILURE | MSG_TASK_CANCELLED, - bprintf("while executing task %s", - MSG_task_get_name(task))); -} - -/*************************************************************************************** - * Unsortable functions * - ***************************************************************************************/ - - -JNIEXPORT jint JNICALL -Java_simgrid_msg_Msg_getErrCode(JNIEnv * env, jclass cls) -{ - return (jint) MSG_get_errno(); -} - -JNIEXPORT jdouble JNICALL -Java_simgrid_msg_Msg_getClock(JNIEnv * env, jclass cls) -{ - return (jdouble) MSG_get_clock(); -} - - -JNIEXPORT void JNICALL -Java_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs) -{ - char **argv = NULL; - int index; - int argc = 0; - jstring jval; - const char *tmp; - - factory_initializer_to_use = SIMIX_ctx_java_factory_init; - - if (jargs) - argc = (int) (*env)->GetArrayLength(env, jargs); - - argc++; - argv = xbt_new0(char *, argc); - argv[0] = strdup("java"); - - for (index = 0; index < argc - 1; index++) { - jval = (jstring) (*env)->GetObjectArrayElement(env, jargs, index); - tmp = (*env)->GetStringUTFChars(env, jval, 0); - argv[index + 1] = strdup(tmp); - (*env)->ReleaseStringUTFChars(env, jval, tmp); - } - - MSG_global_init(&argc, argv); - - for (index = 0; index < argc; index++) - free(argv[index]); - - free(argv); - - (*env)->GetJavaVM(env, &__java_vm); -} - -JNIEXPORT void JNICALL - JNICALL Java_simgrid_msg_Msg_run(JNIEnv * env, jclass cls) -{ - MSG_error_t rv; - int index; //xbt_fifo_item_t item = NULL; - m_host_t *hosts; - jobject jhost; - - /* Run everything */ - rv = MSG_main(); - jxbt_check_res("MSG_main()", rv, MSG_OK, - bprintf - ("unexpected error : MSG_main() failed .. please report this bug ")); - - DEBUG0 - ("MSG_main finished. Bail out before cleanup since there is a bug in this part."); - - DEBUG0("Clean java world"); - /* Cleanup java hosts */ - hosts = MSG_get_host_table(); - for (index = 0; index < MSG_get_host_number() - 1; index++) { - jhost = (jobject) hosts[index]->data; - if (jhost) - jhost_unref(env, jhost); - - } - - DEBUG0("Clean native world"); - /* cleanup native stuff */ - rv = MSG_OK != MSG_clean(); - jxbt_check_res("MSG_clean()", rv, MSG_OK, - bprintf - ("unexpected error : MSG_clean() failed .. please report this bug ")); - -} - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_processKillAll(JNIEnv * env, jclass cls, - jint jresetPID) -{ - return (jint) MSG_process_killall((int) jresetPID); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls, - jstring jplatformFile) -{ - - const char *platformFile = - (*env)->GetStringUTFChars(env, jplatformFile, 0); - - MSG_create_environment(platformFile); - - (*env)->ReleaseStringUTFChars(env, jplatformFile, platformFile); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processExit(JNIEnv * env, jclass cls, - jobject jprocess) -{ - - m_process_t process = jprocess_to_native_process(jprocess, env); - - if (!process) { - jxbt_throw_notbound(env, "process", jprocess); - return; - } - - SIMIX_context_stop(SIMIX_process_self()->context); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_Msg_info(JNIEnv * env, jclass cls, jstring js) -{ - const char *s = (*env)->GetStringUTFChars(env, js, 0); - INFO1("%s", s); - (*env)->ReleaseStringUTFChars(env, js, s); -} - -JNIEXPORT jobjectArray JNICALL -Java_simgrid_msg_MsgNative_allHosts(JNIEnv * env, jclass cls_arg) -{ - int index; - jobjectArray jtable; - jobject jhost; - jstring jname; - m_host_t host; - - int count = MSG_get_host_number(); - m_host_t *table = MSG_get_host_table(); - - jclass cls = jxbt_get_class(env, "simgrid/msg/Host"); - - if (!cls) { - return NULL; - } - - jtable = (*env)->NewObjectArray(env, (jsize) count, cls, NULL); - - if (!jtable) { - jxbt_throw_jni(env, "Hosts table allocation failed"); - return NULL; - } - - for (index = 0; index < count; index++) { - host = table[index]; - jhost = (jobject) (MSG_host_get_data(host)); - - if (!jhost) { - jname = (*env)->NewStringUTF(env, MSG_host_get_name(host)); - - jhost = - Java_simgrid_msg_MsgNative_hostGetByName(env, cls_arg, jname); - /* FIXME: leak of jname ? */ - } - - (*env)->SetObjectArrayElement(env, jtable, index, jhost); - } - - return jtable; -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_taskSend(JNIEnv * env, jclass cls, - jstring jalias, jobject jtask, - jdouble jtimeout) -{ - - MSG_error_t rv; - const char *alias = (*env)->GetStringUTFChars(env, jalias, 0); - - m_task_t task = jtask_to_native_task(jtask, env); - - - if (!task) { - (*env)->ReleaseStringUTFChars(env, jalias, alias); - jxbt_throw_notbound(env, "task", jtask); - return; - } - - /* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */ - MSG_task_set_data(task, (void *) (*env)->NewGlobalRef(env, jtask)); - rv = MSG_task_send_with_timeout(task, alias, (double) jtimeout); - - (*env)->ReleaseStringUTFChars(env, jalias, alias); - - jxbt_check_res("MSG_task_send_with_timeout()", rv, - MSG_HOST_FAILURE | MSG_TRANSFER_FAILURE | MSG_TIMEOUT, - bprintf("while sending task %s to mailbox %s", - MSG_task_get_name(task), alias)); -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_taskSendBounded(JNIEnv * env, jclass cls, - jstring jalias, jobject jtask, - jdouble jmaxRate) -{ - m_task_t task = jtask_to_native_task(jtask, env); - MSG_error_t rv; - const char *alias; - - if (!task) { - jxbt_throw_notbound(env, "task", jtask); - return; - } - - alias = (*env)->GetStringUTFChars(env, jalias, 0); - - /* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */ - MSG_task_set_data(task, (void *) (*env)->NewGlobalRef(env, jtask)); - rv = MSG_task_send_bounded(task, alias, (double) jmaxRate); - - (*env)->ReleaseStringUTFChars(env, jalias, alias); - - jxbt_check_res("MSG_task_send_bounded()", rv, - MSG_HOST_FAILURE | MSG_TRANSFER_FAILURE | MSG_TIMEOUT, - bprintf - ("while sending task %s to mailbox %s with max rate %f", - MSG_task_get_name(task), alias, (double) jmaxRate)); - -} - -JNIEXPORT jobject JNICALL -Java_simgrid_msg_MsgNative_taskReceive(JNIEnv * env, jclass cls, - jstring jalias, jdouble jtimeout, - jobject jhost) -{ - MSG_error_t rv; - m_task_t task = NULL; - m_host_t host = NULL; - jobject jtask_global, jtask_local; - const char *alias; - - if (jhost) { - host = jhost_get_native(env, jhost); - - if (!host) { - jxbt_throw_notbound(env, "host", jhost); - return NULL; - } - } - - alias = (*env)->GetStringUTFChars(env, jalias, 0); - - rv = MSG_task_receive_ext(&task, alias, (double) jtimeout, host); - jtask_global = MSG_task_get_data(task); - - /* Convert the global ref into a local ref so that the JVM can free the stuff */ - jtask_local = (*env)->NewLocalRef(env, jtask_global); - (*env)->DeleteGlobalRef(env, jtask_global); - MSG_task_set_data(task, NULL); - - (*env)->ReleaseStringUTFChars(env, jalias, alias); - - jxbt_check_res("MSG_task_receive_ext()", rv, - MSG_HOST_FAILURE | MSG_TRANSFER_FAILURE | MSG_TIMEOUT, - bprintf("while receiving from mailbox %s", alias)); - - return (jobject) jtask_local; -} - -JNIEXPORT jboolean JNICALL -Java_simgrid_msg_MsgNative_taskListen(JNIEnv * env, jclass cls, - jstring jalias) -{ - - const char *alias; - int rv; - - alias = (*env)->GetStringUTFChars(env, jalias, 0); - - rv = MSG_task_listen(alias); - - (*env)->ReleaseStringUTFChars(env, jalias, alias); - - return (jboolean) rv; -} - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_taskListenFromHost(JNIEnv * env, jclass cls, - jstring jalias, - jobject jhost) -{ - int rv; - const char *alias; - - m_host_t host = jhost_get_native(env, jhost); - - if (!host) { - jxbt_throw_notbound(env, "host", jhost); - return -1; - } - alias = (*env)->GetStringUTFChars(env, jalias, 0); - - rv = MSG_task_listen_from_host(alias, host); - - (*env)->ReleaseStringUTFChars(env, jalias, alias); - - return (jint) rv; -} - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv * env, jclass cls, - jstring jalias) -{ - - int rv; - const char *alias = (*env)->GetStringUTFChars(env, jalias, 0); - - rv = MSG_task_listen_from(alias); - - (*env)->ReleaseStringUTFChars(env, jalias, alias); - - return (jint) rv; -} - -JNIEXPORT void JNICALL -Java_simgrid_msg_Msg_deployApplication(JNIEnv * env, jclass cls, - jstring jdeploymentFile) -{ - - const char *deploymentFile = - (*env)->GetStringUTFChars(env, jdeploymentFile, 0); - - surf_parse_reset_parser(); - - surfxml_add_callback(STag_surfxml_process_cb_list, - japplication_handler_on_begin_process); - - surfxml_add_callback(ETag_surfxml_argument_cb_list, - japplication_handler_on_process_arg); - - surfxml_add_callback(STag_surfxml_prop_cb_list, - japplication_handler_on_property); - - surfxml_add_callback(ETag_surfxml_process_cb_list, - japplication_handler_on_end_process); - - surf_parse_open(deploymentFile); - - japplication_handler_on_start_document(); - - if (surf_parse()) - jxbt_throw_jni(env, "surf_parse() failed"); - - surf_parse_close(); - - japplication_handler_on_end_document(); - - (*env)->ReleaseStringUTFChars(env, jdeploymentFile, deploymentFile); -} diff --git a/src/java/jmsg.h b/src/java/jmsg.h deleted file mode 100644 index dffe8b987f..0000000000 --- a/src/java/jmsg.h +++ /dev/null @@ -1,344 +0,0 @@ -/* Java Wrappers to the MSG API. */ - -/* Copyright (c) 2007, 2008, 2009, 2010. 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. */ - -#ifndef MSG4JAVA_H -#define MSG4JAVA_H - -#include - -JavaVM *get_java_VM(void); - -JNIEnv *get_current_thread_env(void); - -/* - * Class simgrid_msg_Msg - * Method processCreate - * Signature (Lsimgrid/msg/Process;Lsimgrid/msg/Host;)V - */ -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processCreate(JNIEnv * env, jclass cls, - jobject jprocess, jobject jhost); - - - -/* - * Class simgrid_msg_Msg - * Method processSuspend - * Signature (Lsimgrid/msg/Process;)V - */ -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_processSuspend(JNIEnv * env, jclass cls, - jobject jprocess); - -/* - * Class simgrid_msg_Msg - * Method processResume - * Signature (Lsimgrid/msg/Process;)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_processResume - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method processIsSuspended - * Signature (Lsimgrid/msg/Process;)Z - */ -JNIEXPORT jboolean JNICALL Java_simgrid_msg_MsgNative_processIsSuspended - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method processKill - * Signature (Lsimgrid/msg/Process;)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_processKill - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method processGetHost - * Signature (Lsimgrid/msg/Process;)Lsimgrid/msg/Host; - */ -JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_processGetHost - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method processFromPID - * Signature (I)Lsimgrid/msg/Process; - */ -JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_processFromPID - (JNIEnv *, jclass, jint); - -/* - * Class simgrid_msg_Msg - * Method processGetPID - * Signature (Lsimgrid/msg/Process;)I - */ -JNIEXPORT jint JNICALL Java_simgrid_msg_MsgNative_processGetPID - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method processGetPPID - * Signature (Lsimgrid/msg/Process;)I - */ -JNIEXPORT jint JNICALL Java_simgrid_msg_MsgNative_processGetPPID - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method processSelf - * Signature ()Lsimgrid/msg/Process; - */ -JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_processSelf - (JNIEnv *, jclass); - -/* - * Class simgrid_msg_Msg - * Method processSelfPID - * Signature ()I - */ -JNIEXPORT jint JNICALL Java_simgrid_msg_MsgNative_processSelfPID - (JNIEnv *, jclass); - -/* - * Class simgrid_msg_Msg - * Method processSelfPPID - * Signature ()I - */ -JNIEXPORT jint JNICALL Java_simgrid_msg_MsgNative_processSelfPPID - (JNIEnv *, jclass); - -/* - * Class simgrid_msg_Msg - * Method processChangeHost - * Signature (Lsimgrid/msg/Process;Lsimgrid/msg/Host;)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_processChangeHost - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method processWaitFor - * Signature (D)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_processWaitFor - (JNIEnv *, jclass, jdouble); - -/* - * Class simgrid_msg_Msg - * Method hostGetByName - * Signature (Ljava/lang/String;)Lsimgrid/msg/Host; - */ -JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_hostGetByName - (JNIEnv *, jclass, jstring); - -/* - * Class simgrid_msg_Msg - * Method hostGetName - * Signature (Lsimgrid/msg/Host;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_simgrid_msg_MsgNative_hostGetName - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method hostGetNumber - * Signature ()I - */ -JNIEXPORT jint JNICALL Java_simgrid_msg_MsgNative_hostGetNumber - (JNIEnv *, jclass); - -/* - * Class simgrid_msg_Msg - * Method hostSelf - * Signature ()Lsimgrid/msg/Host; - */ -JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_hostSelf - (JNIEnv *, jclass); - -/* - * Class simgrid_msg_Msg - * Method hostGetSpeed - * Signature (Lsimgrid/msg/Host;)D - */ -JNIEXPORT jdouble JNICALL Java_simgrid_msg_MsgNative_hostGetSpeed - (JNIEnv *, jclass, jobject); - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_hostGetLoad(JNIEnv * env, jclass cls, - jobject jhost); - -/* - * Class simgrid_msg_Msg - * Method hostIsAvail - * Signature (Lsimgrid/msg/Host;)Z - */ -JNIEXPORT jboolean JNICALL Java_simgrid_msg_MsgNative_hostIsAvail - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method taskCreate - * Signature (Lsimgrid/msg/Task;Ljava/lang/String;DD)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_taskCreate - (JNIEnv *, jclass, jobject, jstring, jdouble, jdouble); - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_parallel_taskCreate(JNIEnv *, jclass, jobject, - jstring, jobjectArray, - jdoubleArray, jdoubleArray); - -/* - * Class simgrid_msg_Msg - * Method taskGetSender - * Signature (Lsimgrid/msg/Task;)Lsimgrid/msg/Process; - */ -JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_taskGetSender - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method taskGetSource - * Signature (Lsimgrid/msg/Task;)Lsimgrid/msg/Host; - */ -JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_taskGetSource - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method taskGetName - * Signature (Lsimgrid/msg/Task;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_simgrid_msg_MsgNative_taskGetName - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method taskCancel - * Signature (Lsimgrid/msg/Task;)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_taskCancel - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method taskGetComputeDuration - * Signature (Lsimgrid/msg/Task;)D - */ -JNIEXPORT jdouble JNICALL Java_simgrid_msg_MsgNative_taskGetComputeDuration - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method taskGetRemainingDuration - * Signature (Lsimgrid/msg/Task;)D - */ -JNIEXPORT jdouble JNICALL -Java_simgrid_msg_MsgNative_taskGetRemainingDuration(JNIEnv *, jclass, - jobject); - -/* - * Class simgrid_msg_Msg - * Method taskSetPriority - * Signature (Lsimgrid/msg/Task;D)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_taskSetPriority - (JNIEnv *, jclass, jobject, jdouble); - -/* - * Class simgrid_msg_Msg - * Method taskDestroy - * Signature (Lsimgrid/msg/Task;)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_taskDestroy - (JNIEnv *, jclass, jobject); - -/* - * Class simgrid_msg_Msg - * Method taskExecute - * Signature (Lsimgrid/msg/Task;)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_taskExecute - (JNIEnv *, jclass, jobject); - -JNIEXPORT jobject JNICALL - Java_simgrid_msg_MsgNative_taskReceive - (JNIEnv *, jclass, jstring, jdouble, jobject); - -JNIEXPORT void JNICALL - Java_simgrid_msg_MsgNative_taskSend - (JNIEnv *, jclass, jstring, jobject, jdouble); - -/* - * Class simgrid_msg_Msg - * Method getErrCode - * Signature ()I - */ -JNIEXPORT jint JNICALL Java_simgrid_msg_Msg_getErrCode(JNIEnv *, jclass); - -/* - * Class simgrid_msg_Msg - * Method getClock - * Signature ()D - */ -JNIEXPORT jdouble JNICALL Java_simgrid_msg_Msg_getClock(JNIEnv *, jclass); - -JNIEXPORT void JNICALL - JNICALL Java_simgrid_msg_Msg_run(JNIEnv * env, jclass cls); - -JNIEXPORT void JNICALL -Java_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs); - -/* - * Class simgrid_msg_Msg - * Method processKillAll - * Signature (I)I - */ -JNIEXPORT jint JNICALL Java_simgrid_msg_MsgNative_processKillAll - (JNIEnv *, jclass, jint); - -/* - * Class simgrid_msg_Msg - * Method processExit - * Signature (Lsimgrid/msg/Process;)V - */ -JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_processExit - (JNIEnv *, jclass, jobject); - -JNIEXPORT void JNICALL Java_simgrid_msg_Msg_info(JNIEnv *, jclass, - jstring); - -JNIEXPORT jobjectArray JNICALL -Java_simgrid_msg_MsgNative_allHosts(JNIEnv *, jclass); - -JNIEXPORT void JNICALL -Java_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls, - jstring jplatformFile); - -JNIEXPORT void JNICALL -Java_simgrid_msg_MsgNative_taskSendBounded(JNIEnv *, jclass, jstring, - jobject, jdouble); - -JNIEXPORT jboolean JNICALL -Java_simgrid_msg_MsgNative_taskListen(JNIEnv *, jclass, jstring); - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_taskListenFromHost(JNIEnv *, jclass, jstring, - jobject); - -JNIEXPORT jint JNICALL -Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv *, jclass, jstring); - -JNIEXPORT void JNICALL -Java_simgrid_msg_Msg_deployApplication(JNIEnv * env, jclass cls, - jstring jdeploymentFile); - -#endif /* !MSG4JAVA_H */ diff --git a/src/java/jmsg_application_handler.c b/src/java/jmsg_application_handler.c deleted file mode 100644 index f22746424c..0000000000 --- a/src/java/jmsg_application_handler.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Upcalls to the Java functions used as callback to the FleXML parser. */ - -/* Copyright (c) 2008, 2009, 2010. 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. */ - -#include "jmsg_application_handler.h" - -#include "jmsg.h" - -#include "surf/surfxml_parse.h" -#include "jxbt_utilities.h" -void japplication_handler_on_start_document(void) -{ - jclass cls; - JNIEnv *env = get_current_thread_env(); - jmethodID id = - jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler", - "onStartDocument", "()V"); - - if (!id - || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler"))) - return; - - (*env)->CallStaticVoidMethod(env, cls, id); -} - -void japplication_handler_on_end_document(void) -{ - jclass cls; - JNIEnv *env = get_current_thread_env(); - jmethodID id = - jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler", - "onEndDocument", "()V"); - - if (!id - || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler"))) - return; - - (*env)->CallStaticVoidMethod(env, cls, id); -} - -void japplication_handler_on_begin_process(void) -{ - jstring jhostName; - jstring jfunction; - jclass cls; - JNIEnv *env = get_current_thread_env(); - jmethodID id = - jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler", - "onBeginProcess", - "(Ljava/lang/String;Ljava/lang/String;)V"); - if (!id - || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler"))) - return; - jhostName = (jstring) (*env)->NewStringUTF(env, A_surfxml_process_host); - jfunction = - (jstring) (*env)->NewStringUTF(env, A_surfxml_process_function); - (*env)->CallStaticVoidMethod(env, cls, id, jhostName, jfunction); -} - -void japplication_handler_on_process_arg(void) -{ - jstring jarg; - jclass cls; - JNIEnv *env = get_current_thread_env(); - jmethodID id = - jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler", - "onProcessArg", "(Ljava/lang/String;)V"); - if (!id - || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler"))) - return; - jarg = (jstring) (*env)->NewStringUTF(env, A_surfxml_argument_value); - - (*env)->CallStaticVoidMethod(env, cls, id, jarg); -} - -void japplication_handler_on_property(void) -{ - jstring jid; - jstring jvalue; - jclass cls; - JNIEnv *env = get_current_thread_env(); - jmethodID id = - jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler", - "onProperty", - "(Ljava/lang/String;Ljava/lang/String;)V"); - if (!id - || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler"))) - return; - - jid = (jstring) (*env)->NewStringUTF(env, A_surfxml_prop_id); - jvalue = (jstring) (*env)->NewStringUTF(env, A_surfxml_prop_value); - (*env)->CallStaticVoidMethod(env, cls, id, jid, jvalue); -} - -void japplication_handler_on_end_process(void) -{ - JNIEnv *env = get_current_thread_env(); - jclass cls; - jmethodID id = - jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler", - "onEndProcess", "()V"); - if (!id - || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler"))) - return; - (*env)->CallStaticVoidMethod(env, cls, id); -} diff --git a/src/java/jmsg_application_handler.h b/src/java/jmsg_application_handler.h deleted file mode 100644 index 7d3a2159d3..0000000000 --- a/src/java/jmsg_application_handler.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Upcalls to the Java functions used as callback to the FleXML parser. */ - -/* Copyright (c) 2008, 2009, 2010. 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. */ - -#ifndef MSG_JAPPLICATION_HANDLER_H -#define MSG_JAPPLICATION_HANDLER_H - -#include -#include "msg/msg.h" -void japplication_handler_on_start_document(void); -void japplication_handler_on_end_document(void); -void japplication_handler_on_begin_process(void); -void japplication_handler_on_process_arg(void); -void japplication_handler_on_property(void); -void japplication_handler_on_end_process(void); - -#endif /* !MSG_JAPPLICATION_HANDLER_H */ diff --git a/src/java/jmsg_host.c b/src/java/jmsg_host.c deleted file mode 100644 index 26edfa2f6e..0000000000 --- a/src/java/jmsg_host.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Functions related to the java host instances. */ - -/* Copyright (c) 2007, 2009, 2010. 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. */ - -#include "xbt/str.h" -#include "jmsg.h" -#include "jmsg_host.h" -#include "jxbt_utilities.h" - -jobject jhost_new_instance(JNIEnv * env) -{ - - jclass cls = jxbt_get_class(env, "simgrid/msg/Host"); - jmethodID constructor = jxbt_get_jmethod(env, cls, "", "()V"); - - if (!constructor) - return NULL; - - return (*env)->NewObject(env, cls, constructor); -} - -jobject jhost_ref(JNIEnv * env, jobject jhost) -{ - return (*env)->NewGlobalRef(env, jhost); -} - -void jhost_unref(JNIEnv * env, jobject jhost) -{ - (*env)->DeleteGlobalRef(env, jhost); -} - -void jhost_bind(jobject jhost, m_host_t host, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Host", "bind", "J"); - - if (!id) - return; - - (*env)->SetLongField(env, jhost, id, (jlong) (long) (host)); -} - -m_host_t jhost_get_native(JNIEnv * env, jobject jhost) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Host", "bind", "J"); - - if (!id) - return NULL; - - return (m_host_t) (long) (*env)->GetLongField(env, jhost, id); -} - -const char *jhost_get_name(jobject jhost, JNIEnv * env) -{ - m_host_t host = jhost_get_native(env, jhost); - return (const char *) host->name; -} - -void jhost_set_name(jobject jhost, jstring jname, JNIEnv * env) -{ - const char *name; - m_host_t host = jhost_get_native(env, jhost); - - name = (*env)->GetStringUTFChars(env, jname, 0); - - if (host->name) - free(host->name); - - host->name = xbt_strdup(name); - (*env)->ReleaseStringUTFChars(env, jname, name); -} - -jboolean jhost_is_valid(jobject jhost, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Host", "bind", "J"); - - if (!id) - return 0; - - if ((*env)->GetLongField(env, jhost, id)) { - return JNI_TRUE; - } else { - return JNI_FALSE; - } -} diff --git a/src/java/jmsg_host.h b/src/java/jmsg_host.h deleted file mode 100644 index 1f40c13f38..0000000000 --- a/src/java/jmsg_host.h +++ /dev/null @@ -1,110 +0,0 @@ -/* Functions related to the java host instances. */ - -/* Copyright (c) 2007, 2009, 2010. 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. */ - -#ifndef MSG_JHOST_H -#define MSG_JHOST_H - -#include -#include "msg/msg.h" - -/** - * This function returns a new java host instance. - * - * @param env The environment of the current thread - * - * @return A new java host object. - * - * @exception If the class Host is not found the function throws - * the ClassNotFoundException. If the constructor of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -jobject jhost_new_instance(JNIEnv * env); - -/** - * This function returns a global reference to the java host instance - * specified by the parameter jhost. - * - * @param jhost The original java host instance. - * @param env The environment of the current thread - * - * @return The global reference to the original java host - * instance. - */ -jobject jhost_ref(JNIEnv * env, jobject jhost); -/** - * This function delete a global reference to a java host instance. - * - * @param The global refernce to delete. - * @param env The environment of the current thread - */ -void jhost_unref(JNIEnv * env, jobject jhost); - -/** - * This function associated a native host to a java host instance. - * - * @param jhost The java host instance. - * @param host The native host to bind. - * @param env The environment of the current thread - * - * @exception If the class Host is not found the function throws - * the ClassNotFoundException. If the field bind of - * this class is not found the function throws the exception - * NotSuchFieldException. - */ -void jhost_bind(jobject jhost, m_host_t host, JNIEnv * env); - -/** - * This function returns a native host from a java host instance. - * - * @param jhost The java host object from which get the native host. - * @param env The environment of the current thread - * - * @return The function returns the native host associated to the - * java host object. - * - * @exception If the class Host is not found the function throws - * the ClassNotFoundException. If the field bind of - * this class is not found the function throws the exception - * NotSuchFieldException. - */ -m_host_t jhost_get_native(JNIEnv * env, jobject jhost); - -/** - * This function returns the name of a MSG host. - * - * @param jhost A java host object. - * @param env The environment of the current thread - * - * @return The name of the host. - */ -const char *jhost_get_name(jobject jhost, JNIEnv * env); - - -/** - * This function sets the name of a MSG host. - * - * @param host The host concerned by the operation. - * @param jname The new name of the host. - * @param env The environment of the current thread - */ -void jhost_set_name(jobject jhost, jstring jname, JNIEnv * env); - -/** - * This function tests if a java host instance is valid. - * A java host object is valid if it is bind to a native host. - * - * @param jhost The host to test the validity. - * @param env The environment of the current thread - * - * @return If the java host is valid the function returns true. - * Otherwise the function returns false. - */ -jboolean jhost_is_valid(jobject jhost, JNIEnv * env); - -#endif /*!MSG_JHOST_H */ diff --git a/src/java/jmsg_process.c b/src/java/jmsg_process.c deleted file mode 100644 index 6ebb133fc8..0000000000 --- a/src/java/jmsg_process.c +++ /dev/null @@ -1,216 +0,0 @@ -/* Functions related to the java process instances. */ - -/* Copyright (c) 2007, 2008, 2009, 2010. 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. */ - -#include "jmsg_process.h" -#include "jmsg.h" -#include "jxbt_utilities.h" - -#include "simix/smx_context_java.h" - -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg); - -jobject jprocess_new_global_ref(jobject jprocess, JNIEnv * env) -{ - return (*env)->NewGlobalRef(env, jprocess); -} - -void jprocess_delete_global_ref(jobject jprocess, JNIEnv * env) -{ - (*env)->DeleteGlobalRef(env, jprocess); -} - -jboolean jprocess_is_alive(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "isAlive", "()Z"); - - if (!id) - return 0; - - return (*env)->CallBooleanMethod(env, jprocess, id); -} - -void jprocess_join(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "join", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, jprocess, id); -} - -void jprocess_exit(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "interrupt", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, jprocess, id); -} - -void jprocess_yield(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "switchProcess", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, jprocess, id); -} - -void jprocess_lock_mutex(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "lockMutex", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, jprocess, id); -} - -void jprocess_unlock_mutex(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "unlockMutex", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, jprocess, id); -} - - -void jprocess_signal_cond(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "signalCond", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, jprocess, id); -} - -void jprocess_wait_cond(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "waitCond", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, jprocess, id); -} - - -void jprocess_start(jobject jprocess, JNIEnv * env) -{ - jmethodID id = - jxbt_get_smethod(env, "simgrid/msg/Process", "start", "()V"); - - if (!id) - return; - - DEBUG2("jprocess_start(jproc=%p,env=%p)", jprocess, env); - (*env)->CallVoidMethod(env, jprocess, id); - DEBUG0("jprocess started"); -} - -m_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "bind", "J"); - - if (!id) - return NULL; - - return (m_process_t) (long) (*env)->GetLongField(env, jprocess, id); -} - -void jprocess_bind(jobject jprocess, m_process_t process, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "bind", "J"); - - if (!id) - return; - - (*env)->SetLongField(env, jprocess, id, (jlong) (long) (process)); -} - -jlong jprocess_get_id(jobject jprocess, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "id", "J"); - - if (!id) - return 0; - - return (*env)->GetLongField(env, jprocess, id); -} - -jstring jprocess_get_name(jobject jprocess, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "name", - "Ljava/lang/String;"); - jobject jname; - - if (!id) - return NULL; - - jname = (jstring) (*env)->GetObjectField(env, jprocess, id); - - return (*env)->NewGlobalRef(env, jname); - -} - -jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "bind", "J"); - - if (!id) - return JNI_FALSE; - - return (*env)->GetLongField(env, jprocess, id) ? JNI_TRUE : JNI_FALSE; -} - -void jprocess_schedule(smx_context_t context) -{ - JNIEnv *env; - jmethodID id; - - env = get_current_thread_env(); - - id = jxbt_get_smethod(env, "simgrid/msg/Process", "schedule", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, ((smx_ctx_java_t) context)->jprocess, id); -} - - - -void jprocess_unschedule(smx_context_t context) -{ - JNIEnv *env; - jmethodID id; - - env = get_current_thread_env(); - - - id = jxbt_get_smethod(env, "simgrid/msg/Process", "unschedule", "()V"); - - if (!id) - return; - - (*env)->CallVoidMethod(env, ((smx_ctx_java_t) context)->jprocess, id); -} diff --git a/src/java/jmsg_process.h b/src/java/jmsg_process.h deleted file mode 100644 index 8d3862a90d..0000000000 --- a/src/java/jmsg_process.h +++ /dev/null @@ -1,242 +0,0 @@ -/* Functions related to the java process instances. */ - -/* Copyright (c) 2007, 2009, 2010. 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. */ - -#ifndef MSG_JPROCESS_H -#define MSG_JPROCESS_H - -#include -#include "msg/msg.h" -#include "simix/simix.h" - -/** - * This function returns a global reference to the java process instance - * specified by the parameter jprocess. - * - * @param jprocess The original java process instance. - * @param env The env of the current thread - * - * @return The global reference to the original java process - * instance. - */ -jobject jprocess_new_global_ref(jobject jprocess, JNIEnv * env); - -/** - * This function delete a global reference to a java process instance. - * If the java process is alive the function joins it and stops it before. - * - * @param The global refernce to delete. - * @param env The env of the current thread - * - * @see jprocess_join() - * @see jprocess_exit() - */ -void jprocess_delete_global_ref(jobject jprocess, JNIEnv * env); - -/** - * - * This function tests if the specified java process instance is alive. - * A java process object is alive if it has been started and has not yet - * terminated. - * - * @param jprocess The java process to test. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the methos isAlive() of - * this class is not found the function throws the exception - * NotSuchMethodException. - * - * @return If the java process is alive the function returns - * true. Otherwise the function returns false. - */ -jboolean jprocess_is_alive(jobject jprocess, JNIEnv * env); - -/** - * This function waits for a java process to terminate. - * - * @param jprocess The java process ot wait for. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the methos join() of - * this class is not found the function throws the exception - * NotSuchMethodException. - * - */ -void jprocess_join(jobject jprocess, JNIEnv * env); - -/** - * This function starts the specified java process. - * - * @param jprocess The java process to start. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the methos start() of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_start(jobject jprocess, JNIEnv * env); - -/** - * This function forces the java process to stop. - * - * @param jprocess The java process to stop. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the methos stop() of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_exit(jobject jprocess, JNIEnv * env); - -/** - * This function associated a native process to a java process instance. - * - * @param jprocess The java process instance. - * @param process The native process to bind. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the field bind of - * this class is not found the function throws the exception - * NotSuchFieldException. - */ -void jprocess_bind(jobject jprocess, m_process_t process, JNIEnv * env); - -/** - * This function returns a native process from a java process instance. - * - * @param jprocess The java process object from which get the native process. - * @param env The env of the current thread - * - * @return The function returns the native process associated to the - * java process object. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the field bind of - * this class is not found the function throws the exception - * NotSuchFieldException. - */ -m_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env); - -/** - * This function gets the id of the specified java process. - * - * @param jprocess The java process to get the id. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the field id of - * this class is not found the function throws the exception - * NotSuchFieldException. - * - * @return The id of the specified java process. - */ -jlong jprocess_get_id(jobject jprocess, JNIEnv * env); - -/** - * This function tests if a java process instance is valid. - * A java process object is valid if it is bind to a native - * process. - * - * @param jprocess The java process to test the validity. - * @param env The env of the current thread - * - * @return If the java process is valid the function returns true. - * Otherwise the function returns false. - */ -jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env); - -/** - * This function gets the name of the specified java process. - * - * @param jprocess The java process to get the name. - * @param env The env of the current thread - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the field name of - * this class is not found the function throws the exception - * NotSuchFieldException. - * - * @return The name of the specified java process. - */ -jstring jprocess_get_name(jobject jprocess, JNIEnv * env); - -/** - * This function yields the specified java process. - * - * @param jprocess The java process to yield. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method switchProcess of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_yield(jobject jprocess, JNIEnv * env); - -/** - * This function locks the mutex of the specified java process. - * - * @param jprocess The java process of the mutex to lock. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method lockMutex of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_lock_mutex(jobject jprocess, JNIEnv * env); - -/** - * This function unlocks the mutex of the specified java process. - * - * @param jprocess The java process of the mutex to unlock. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method unlockMutex of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_unlock_mutex(jobject jprocess, JNIEnv * env); - -/** - * This function signals the condition of the mutex of the specified java process. - * - * @param jprocess The java process of the condtion to signal. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method signalCond of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_signal_cond(jobject jprocess, JNIEnv * env); - -/** - * This function waits the condition of the mutex of the specified java process. - * - * @param jprocess The java process of the condtion to wait for. - * @param env The env of the current thread. - * - * @exception If the class Process is not found the function throws - * the ClassNotFoundException. If the method waitCond of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ -void jprocess_wait_cond(jobject jprocess, JNIEnv * env); - -void jprocess_schedule(smx_context_t context); - -void jprocess_unschedule(smx_context_t context); - - -#endif /* !MSG_JPROCESS_H */ diff --git a/src/java/jmsg_task.c b/src/java/jmsg_task.c deleted file mode 100644 index 7214d2111a..0000000000 --- a/src/java/jmsg_task.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Functions related to the java task instances. */ - -/* Copyright (c) 2007, 2009, 2010. 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. */ - -#include "jmsg.h" -#include "jmsg_task.h" -#include "jxbt_utilities.h" - -void jtask_bind(jobject jtask, m_task_t task, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J"); - - if (!id) - return; - - (*env)->SetLongField(env, jtask, id, (jlong) (long) (task)); -} - -m_task_t jtask_to_native_task(jobject jtask, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J"); - - if (!id) - return NULL; - - return (m_task_t) (long) (*env)->GetLongField(env, jtask, id); -} - -jboolean jtask_is_valid(jobject jtask, JNIEnv * env) -{ - jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J"); - - if (!id) - return JNI_FALSE; - - return (*env)->GetLongField(env, jtask, id) ? JNI_TRUE : JNI_FALSE; -} diff --git a/src/java/jmsg_task.h b/src/java/jmsg_task.h deleted file mode 100644 index 7b07a55c0d..0000000000 --- a/src/java/jmsg_task.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Functions related to the java task instances. */ - -/* Copyright (c) 2007, 2009, 2010. 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. */ - -#ifndef MSG_JTASK_H -#define MSG_JTASK_H - -#include -#include "msg/msg.h" - -/** - * This function returns a global reference to the java task instance - * specified by the parameter jtask. - * - * @param jtask The original java task instance. - * @param env The environment of the current thread. - * - * @return The global reference to the original java task - * instance. - */ -jobject jtask_new_global_ref(jobject jtask, JNIEnv * env); - -/** - * This function delete a global reference to a java task instance. - * - * @param The global refernce to delete. - * @param env The environment of the current thread. - */ -void jtask_delete_global_ref(jobject jtask, JNIEnv * env); - -/** - * This function associated a native task to a java task instance. - * - * @param jtask The java task instance. - * @param task The native task to bind. - * @param env The environment of the current thread. - * - * @exception If the class Task is not found the function throws - * the ClassNotFoundException. If the field bind of - * this class is not found the function throws the exception - * NotSuchFieldException. - */ -void jtask_bind(jobject jtask, m_task_t task, JNIEnv * env); - -/** - * This function returns a native task from a java task instance. - * - * @param jtask The java task object from which get the native task. - * @param env The environment of the current thread. - * - * @return The function returns the native task associated to the - * java task object. - * - * @exception If the class Task is not found the function throws - * the ClassNotFoundException. If the field bind of - * this class is not found the function throws the exception - * NotSuchFieldException. - */ -m_task_t jtask_to_native_task(jobject jtask, JNIEnv * env); - -/** - * This function tests if a java task instance is valid. - * A java task object is valid if it is bind to a native - * task. - * - * @param jtask The java task to test the validity. - * @param env The environment of the current thread. - * - * @return If the java task is valid the function returns true. - * Otherwise the function returns false. - */ -jboolean jtask_is_valid(jobject jtask, JNIEnv * env); - -#endif /* !MSG_JTASK_H */ diff --git a/src/java/jxbt_utilities.c b/src/java/jxbt_utilities.c deleted file mode 100644 index 6b11b8b0c2..0000000000 --- a/src/java/jxbt_utilities.c +++ /dev/null @@ -1,296 +0,0 @@ -/* Various JNI helper functions */ - -/* Copyright (c) 2007, 2008, 2009, 2010. 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. */ - -#include /* abort */ -#include "xbt/misc.h" -#include "xbt/sysdep.h" -#include "xbt/str.h" -#include "jxbt_utilities.h" - -/* *********** */ -/* JNI GETTERS */ -/* *********** */ - -jclass jxbt_get_class(JNIEnv * env, const char *name) -{ - jclass cls = (*env)->FindClass(env, name); - - if (!cls) { - char *m = bprintf("Class %s not found", name); - jxbt_throw_jni(env, m); - free(m); - return NULL; - } - - return cls; -} - -jmethodID jxbt_get_jmethod(JNIEnv * env, jclass cls, - const char *name, const char *signature) -{ - jmethodID id; - - if (!cls) - return 0; - id = (*env)->GetMethodID(env, cls, name, signature); - - if (!id) { - - jmethodID tostr_id = - (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;"); - jstring jclassname = - (jstring) (*env)->CallObjectMethod(env, cls, tostr_id, NULL); - const char *classname = (*env)->GetStringUTFChars(env, jclassname, 0); - - char *m = bprintf("Cannot find method %s(%s) in %s", name, signature, - classname); - - (*env)->ReleaseStringUTFChars(env, jclassname, classname); - - jxbt_throw_jni(env, m); - - free(m); - return 0; - } - - return id; -} - -jmethodID jxbt_get_static_jmethod(JNIEnv * env, jclass cls, - const char *name, const char *signature) -{ - jmethodID id; - - if (!cls) - return 0; - id = (*env)->GetStaticMethodID(env, cls, name, signature); - - if (!id) { - - jmethodID tostr_id = - (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;"); - jstring jclassname = - (jstring) (*env)->CallObjectMethod(env, cls, tostr_id, NULL); - const char *classname = (*env)->GetStringUTFChars(env, jclassname, 0); - - char *m = - bprintf("Cannot find static method %s(%s) in %s", name, signature, - classname); - - (*env)->ReleaseStringUTFChars(env, jclassname, classname); - - jxbt_throw_jni(env, m); - - free(m); - return 0; - } - - return id; -} - -jmethodID jxbt_get_static_smethod(JNIEnv * env, const char *classname, - const char *name, const char *signature) -{ - - jclass cls; - jmethodID id; - cls = jxbt_get_class(env, classname); - - if (!cls) - return 0; - - id = (*env)->GetStaticMethodID(env, cls, name, signature); - - if (!id) { - char *m = - bprintf("Cannot find static method %s(%s) in %s", name, signature, - classname); - - jxbt_throw_jni(env, m); - - free(m); - return 0; - } - return id; -} - -jmethodID jxbt_get_smethod(JNIEnv * env, const char *classname, - const char *name, const char *signature) -{ - - jclass cls; - jmethodID id; - cls = jxbt_get_class(env, classname); - - if (!cls) - return 0; - - id = (*env)->GetMethodID(env, cls, name, signature); - - if (!id) { - char *m = bprintf("Cannot find method %s(%s) in %s", name, signature, - classname); - - jxbt_throw_jni(env, m); - - free(m); - return 0; - } - return id; -} - -jfieldID jxbt_get_jfield(JNIEnv * env, jclass cls, - const char *name, const char *signature) -{ - jfieldID id; - - if (!cls) - return 0; - - id = (*env)->GetFieldID(env, cls, name, signature); - - if (!id) { - jmethodID getname_id = - (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;"); - jstring jclassname = - (jstring) (*env)->CallObjectMethod(env, cls, getname_id, NULL); - const char *classname = (*env)->GetStringUTFChars(env, jclassname, 0); - char *m = bprintf("Cannot find field %s %s in %s", signature, name, - classname); - - (*env)->ReleaseStringUTFChars(env, jclassname, classname); - - jxbt_throw_jni(env, m); - - free(m); - return 0; - } - - return id; -} - -jfieldID jxbt_get_sfield(JNIEnv * env, const char *classname, - const char *name, const char *signature) -{ - jclass cls = jxbt_get_class(env, classname); - jfieldID id; - - if (!cls) - return 0; - - id = (*env)->GetFieldID(env, cls, name, signature); - - if (!id) { - char *m = bprintf("Cannot find field %s %s in %s", signature, name, - classname); - - jxbt_throw_jni(env, m); - - free(m); - return 0; - } - - return id; -} - -/* ***************** */ -/* EXCEPTION RAISING */ -/* ***************** */ -static void jxbt_throw_by_name(JNIEnv * env, const char *name, char *msg) -{ - jclass cls = (*env)->FindClass(env, name); - - xbt_assert2(cls, "%s (Plus severe error: class %s not found)\n", msg, - name); - - (*env)->ThrowNew(env, cls, msg); - - free(msg); -} - - -/* Errors in MSG */ -void jxbt_throw_jni(JNIEnv * env, const char *msg) -{ - jxbt_throw_by_name(env, - "simgrid/msg/JniException", - bprintf("Internal or JNI error: %s", msg)); -} - -void jxbt_throw_notbound(JNIEnv * env, const char *kind, void *pointer) -{ - jxbt_throw_by_name(env, - "simgrid/msg/JniException", - bprintf("Internal error: %s %p not bound", kind, - pointer)); -} - -void jxbt_throw_native(JNIEnv * env, char *msg) -{ - jxbt_throw_by_name(env, "simgrid/msg/NativeException", msg); -} - -/* *** */ -void jxbt_throw_null(JNIEnv * env, char *msg) -{ - jxbt_throw_by_name(env, "java/lang/NullPointerException", msg); -} - -/* Errors on user side */ -void jxbt_throw_illegal(JNIEnv * env, char *msg) -{ - jxbt_throw_by_name(env, "java/lang/IllegalArgumentException", msg); -} - -void jxbt_throw_host_not_found(JNIEnv * env, const char *invalid_name) -{ - jxbt_throw_by_name(env, - "simgrid/msg/HostNotFoundException", - bprintf("No such host: %s", invalid_name)); -} - -void jxbt_throw_process_not_found(JNIEnv * env, const char *invalid_name) -{ - jxbt_throw_by_name(env, - "simgrid/msg/ProcessNotFoundException", - bprintf("No such process: %s", invalid_name)); -} - -// tranfert failure -void jxbt_throw_transfer_failure(JNIEnv * env, char *details) -{ - - jxbt_throw_by_name(env, "simgrid/msg/TransferFailureException", details); - -} - -// host failure Exception -void jxbt_throw_host_failure(JNIEnv * env, char *details) -{ - - jxbt_throw_by_name(env, - "simgrid/msg/HostFailureException", - bprintf("Host Failure %s", details)); - -} - -// time out failure Exception -void jxbt_throw_time_out_failure(JNIEnv * env, char *details) -{ - - jxbt_throw_by_name(env, "simgrid/msg/TimeoutException", details); - -} - -// task Cancelled exception -void jxbt_throw_task_cancelled(JNIEnv * env, char *details) -{ - - jxbt_throw_by_name(env, "simgrid/msg/TaskCancelledException", details); - -} diff --git a/src/java/jxbt_utilities.h b/src/java/jxbt_utilities.h deleted file mode 100644 index 08bd391873..0000000000 --- a/src/java/jxbt_utilities.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Various JNI helper functions */ - -/* Copyright (c) 2007, 2008, 2009, 2010. 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. */ - -#ifndef JXBT_UTILITY_H -#define JXBT_UTILITY_H - -#include - -/* *********** */ -/* JNI GETTERS */ -/* *********** */ - -/* Search a class and throw an exception if not found */ -jclass jxbt_get_class(JNIEnv * env, const char *name); - -/* Search a method in a class and throw an exception if not found - (it's ok to to pass a NULL class: it's a noop) */ -jmethodID jxbt_get_jmethod(JNIEnv * env, jclass class, - const char *name, const char *signature); - -/* Like the jxbt_get_class() but get a static method */ -jmethodID jxbt_get_static_jmethod(JNIEnv * env, jclass cls, - const char *name, const char *signature); - -/* Search a field in a class and throw an exception if not found - (it's ok to to pass a NULL class: it's a noop) */ -jfieldID jxbt_get_jfield(JNIEnv * env, jclass class, - const char *name, const char *signature); - - -/* Search a method in a class and throw an exception if not found - (it's ok to to pass a NULL class: it's a noop) */ -jmethodID jxbt_get_smethod(JNIEnv * env, const char *classname, - const char *name, const char *signature); - -/* Like the jxbt_get_smethod() but get a static method */ -jmethodID jxbt_get_static_smethod(JNIEnv * env, const char *classname, - const char *name, const char *signature); - -/* Search a field in a class and throw an exception if not found - (it's ok to to pass a NULL class: it's a noop) */ -jfieldID jxbt_get_sfield(JNIEnv * env, const char *classname, - const char *name, const char *signature); - - -/* ***************** */ -/* EXCEPTION RAISING */ -/* ***************** */ - -#define jxbt_check_res(fun, res, allowed_exceptions, detail) do {\ - if (res != MSG_OK && res | allowed_exceptions) { \ - xbt_die(bprintf("%s failed with error code %d, which is not an allowed exception. Please fix me.",fun,res)); \ - } else if (res == MSG_HOST_FAILURE) { \ - jxbt_throw_host_failure(env, detail); \ - } else if (res == MSG_TRANSFER_FAILURE) { \ - jxbt_throw_transfer_failure(env,detail); \ - } else if (res == MSG_TIMEOUT) { \ - jxbt_throw_time_out_failure(env,detail); \ - } else if (res == MSG_TASK_CANCELLED){ \ - jxbt_throw_task_cancelled(env,detail); \ - } } while (0) - -/** Thrown on internal error of this layer, or on problem with JNI */ -void jxbt_throw_jni(JNIEnv * env, const char *msg); -/** Thrown when using an object not bound to a native one where it should, or reverse (kinda JNI issue) */ -void jxbt_throw_notbound(JNIEnv * env, const char *kind, void *pointer); - -/** Thrown on error in native MSG code */ -void jxbt_throw_native(JNIEnv * env, char *msg); - -/** Thrown if NULL gets used */ -void jxbt_throw_null(JNIEnv * env, char *msg); - -/** Thrown on illegal arguments */ -void jxbt_throw_illegal(JNIEnv * env, char *msg); -/** Thrown when looking for an host from name does not lead to anything */ -void jxbt_throw_host_not_found(JNIEnv * env, const char *invalid_name); -/** Thrown when looking for an host from name does not lead to anything */ -void jxbt_throw_process_not_found(JNIEnv * env, const char *invalid_name); -/** Thrown when a transfer failure accure while Sending task */ -void jxbt_throw_transfer_failure(JNIEnv * env, char *detail); -/** Thrown when a host failure accures while Sending task*/ -void jxbt_throw_host_failure(JNIEnv * env, char *details); -/** Thrown when a time out accures While Sending task */ -void jxbt_throw_time_out_failure(JNIEnv * env, char *details); -/**Thrown when a task is canceled */ -void jxbt_throw_task_cancelled(JNIEnv * env, char *details); - -#endif /* ! JXBT_UTILITY_H */ diff --git a/src/java/simgrid/msg/ApplicationHandler.java b/src/java/simgrid/msg/ApplicationHandler.java deleted file mode 100644 index ac5a699f9a..0000000000 --- a/src/java/simgrid/msg/ApplicationHandler.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * These are the upcalls used by the FleXML parser for application files - * - * Copyright 2006,2007,2010 The SimGrid team. - * All right 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. - */ - -package simgrid.msg; - -import java.util.Hashtable; -import java.util.Vector; - -public final class ApplicationHandler { - - - /** - * The vector which contains the arguments of the main function - * of the process object. - */ - public static Vector args; - - public static Hashtable properties; - - /** - * The name of the host of the process. - */ - private static String hostName; - - /** - * The function of the process. - */ - private static String function; - - /** - * This method is called by the start element handler. - * It sets the host and the function of the process to create, - * and clear the vector containing the arguments of the - * previouse process function if needed. - * - * @host The host of the process to create. - * @function The function of the process to create. - * - */ - public static void setProcessIdentity(String hostName_, String function_) { - hostName = hostName_; - function = function_; - - if (!args.isEmpty()) - args.clear(); - - if(!properties.isEmpty()) - properties.clear(); - } - /** - * This method is called by the startElement() handler. - * It stores the argument of the function of the next - * process to create in the vector of arguments. - * - * @arg The argument to add. - * - */ public static void registerProcessArg(String arg) { - args.add(arg); - } - - public static void setProperty(String id, String value) - { - properties.put(id,value); - } - - public static String getHostName() - { - return hostName; - } - - @SuppressWarnings("unchecked") - public static void createProcess() { - try { - Class cls = (Class) Class.forName(function); - - simgrid.msg.Process process = cls.newInstance(); - process.name = function; - process.id = simgrid.msg.Process.nextProcessId++; - Host host = Host.getByName(hostName); - - MsgNative.processCreate(process, host); - Vector args_ = args; - int size = args_.size(); - - for (int index = 0; index < size; index++) - process.args.add(args_.get(index)); - - process.properties = properties; - properties = new Hashtable(); - - } catch(HostNotFoundException e) { - System.out.println(e.toString()); - e.printStackTrace(); - - } catch(ClassNotFoundException e) { - System.out.println(function + - " class not found\n The attribut function of the element process of your deployment file\n must correspond to the name of a Msg Proces class)"); - e.printStackTrace(); - - } catch(InstantiationException e) { - System.out.println("Unable to create the process. I got an instantiation exception"); - e.printStackTrace(); - } catch(IllegalAccessException e) { - System.out.println("Unable to create the process. I got an illegal access exception"); - e.printStackTrace(); - } - - } - - - public static void onStartDocument() { - args = new Vector(); - properties = new Hashtable(); - hostName = null; - function = null; - } - - public static void onBeginProcess(String hostName, String function) { - setProcessIdentity(hostName, function); - - } - public static void onProperty(String id, String value) { - setProperty(id, value); - } - - public static void onProcessArg(String arg) { - registerProcessArg(arg); - } - - public static void onEndProcess() { - createProcess(); - } - - public static void onEndDocument() { - } -} diff --git a/src/java/simgrid/msg/Host.java b/src/java/simgrid/msg/Host.java deleted file mode 100644 index 45af7ff8de..0000000000 --- a/src/java/simgrid/msg/Host.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Bindings to the MSG hosts - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - * - */ -package simgrid.msg; - -/** - * A host object represents a location (any possible place) where a process may run. - * Thus it is represented as a physical resource with computing capabilities, some - * mailboxes to enable running process to communicate with remote ones, and some private - * data that can be only accessed by local process. An instance of this class is always - * binded with the corresponding native host. All the native hosts are automatically created - * during the call of the method Msg.createEnvironment(). This method take as parameter a - * platform file which describes all elements of the platform (host, link, root..). - * You cannot create a host yourself. - * - * The best way to get an host instance is to call the static method - * Host.getByName(). - * - * For example to get the instance of the host. If your platform - * file description contains an host named "Jacquelin" : - * - * \verbatim -Host jacquelin; - -try { - jacquelin = Host.getByName("Jacquelin"); -} catch(HostNotFoundException e) { - System.err.println(e.toString()); -} -... -\endverbatim - * - */ -public class Host { - - /** - * This attribute represents a bind between a java host object and - * a native host. Even if this attribute is public you must never - * access to it. It is set automatically during the call of the - * static method Host.getByName(). - * - * @see Host.getByName(). - */ - public long bind; - - - /** - * User data. - */ - private Object data; - protected Host() { - this.bind = 0; - this.data = null; - }; - - /** - * This static method gets an host instance associated with a native - * host of your platform. This is the best way to get a java host object. - * - * @param name The name of the host to get. - * - * @exception HostNotFoundException if the name of the host is not valid. - * NativeException if the native version of this method failed. - */ - public static Host getByName(String name) - throws HostNotFoundException { - if (name==null) - throw new NullPointerException("No host can have a null name"); - return MsgNative.hostGetByName(name); - } - - /** - * This static method returns the count of the installed hosts. - * - * @return The count of the installed hosts. - * - */ - public static int getCount() { - return MsgNative.hostGetCount(); - } - - /** - * This static method return an instance to the host of the current process. - * - * @return The host on which the current process is executed. - */ - public static Host currentHost() { - return MsgNative.hostSelf(); - } - - /** - * This static method returns all of the hosts of the installed platform. - * - * @return An array containing all the hosts installed. - * - */ - public static Host[] all() { - return MsgNative.allHosts(); - } - - /** - * This method returns the name of a host. - * - * @return The name of the host. - * - */ - public String getName() { - return MsgNative.hostGetName(this); - } - - /** - * Sets the data of the host. - * - */ - public void setData(Object data) { - this.data = data; - } - /** - * Gets the data of the host. - */ - public Object getData() { - return this.data; - } - - /** - * Checks whether a host has data. - */ - public boolean hasData() { - return null != this.data; - } - - /** - * This method returns the number of tasks currently running on a host. - * The external load is not taken in account. - * - * @return The number of tasks currently running on a host. - */ - public int getLoad() { - return MsgNative.hostGetLoad(this); - } - - /** - * This method returns the speed of the processor of a host, - * regardless of the current load of the machine. - * - * @return The speed of the processor of the host in flops. - * - */ - public double getSpeed() { - return MsgNative.hostGetSpeed(this); - } - - /** This method tests if a host is avail. */ - public boolean isAvail() { - return MsgNative.hostIsAvail(this); - } -} diff --git a/src/java/simgrid/msg/HostFailureException.java b/src/java/simgrid/msg/HostFailureException.java deleted file mode 100644 index dfa65f19ec..0000000000 --- a/src/java/simgrid/msg/HostFailureException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This exception is raised when looking for a non-existing host. - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ - -package simgrid.msg; - -/** - * This exception is raised when The host on which you are running has just been rebooted. - */ -public class HostFailureException extends MsgException { - private static final long serialVersionUID = 1L; - - /** Constructs an HostFailureException without a detail message. */ - public HostFailureException() { - super(); - } - /** - * Constructs an HostFailureException with a detail message. - * - * @param s the detail message. - */ - public HostFailureException(String s) { - super(s); - } -} diff --git a/src/java/simgrid/msg/HostNotFoundException.java b/src/java/simgrid/msg/HostNotFoundException.java deleted file mode 100644 index d0e852f282..0000000000 --- a/src/java/simgrid/msg/HostNotFoundException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This exception is raised when looking for a non-existing host. - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ - -package simgrid.msg; - -/** - * This exception is raised when looking for a non-existing host. - */ -public class HostNotFoundException extends MsgException { - private static final long serialVersionUID = 1L; - - /** Constructs an HostNotFoundException without a detail message. */ - public HostNotFoundException() { - super(); - } - /** - * Constructs an HostNotFoundException with a detail message. - * - * @param s the detail message. - */ - public HostNotFoundException(String s) { - super(s); - } -} diff --git a/src/java/simgrid/msg/JniException.java b/src/java/simgrid/msg/JniException.java deleted file mode 100644 index 6592ef5fc8..0000000000 --- a/src/java/simgrid/msg/JniException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This exception is raised when there is a problem within the bindings (in JNI). - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ -package simgrid.msg; - -/** - * This exception is raised when there is a problem within the bindings (in JNI). - * That's a RuntimeException: I guess nobody wants to survive a JNI error in SimGrid - */ -public class JniException extends RuntimeException { - private static final long serialVersionUID = 1L; - - - /** - * Constructs an JniException without a - * detail message. - */ - public JniException() { - super(); - } - /** - * Constructs an JniException with a detail message. - * - * @param s the detail message. - */ public JniException(String s) { - super(s); - } -} diff --git a/src/java/simgrid/msg/Msg.java b/src/java/simgrid/msg/Msg.java deleted file mode 100644 index 40c9ea2d13..0000000000 --- a/src/java/simgrid/msg/Msg.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * JNI interface to C code for MSG. - * - * Copyright 2006,2007,2010 The SimGrid Team. - * All right 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. - */ - -package simgrid.msg; - -public final class Msg { - /* Statically load the library which contains all native functions used in here */ - static { - try { - System.loadLibrary("simgrid"); - } catch(UnsatisfiedLinkError e) { - System.err.println("Cannot load simgrid library: "); - e.printStackTrace(); - System.err.println( - "Please check your LD_LIBRARY_PATH, or copy the library to the current directory"); - System.exit(1); - } - } - - /* FIXME: kill these C crufts */ - /** Returns the last error code of the simulation */ - public final static native int getErrCode(); - - /** Everything is right. Keep on going the way ! */ - public static final int SUCCESS = 0; - - /** Something must be not perfectly clean (but I may be paranoid freak...) */ - public static final int WARNING = 1; - - /** There has been a problem during your task transfer. - * Either the network is down or the remote host has been shutdown */ - public static final int TRANSFERT_FAILURE = 2; - - /** System shutdown. - * The host on which you are running has just been rebooted. - * Free your data structures and return now ! */ - public static final int HOST_FAILURE = 3; - - /** Canceled task. This task has been canceled by somebody ! */ - public static final int TASK_CANCELLLED = 4; - - /** You've done something wrong. You'd better look at it... */ - public static final int FATAL_ERROR = 5; - - /** Retrieve the simulation time */ - public final static native double getClock(); - - /** Issue an information logging message */ - public final static native void info(String s); - - /********************************************************************************* - * Deployment and initialization related functions * - *********************************************************************************/ - - /** - * The natively implemented method to initialize a MSG simulation. - * - * @param args The arguments of the command line of the simulation. - * - * @see Msg.init() - */ - public final static native void init(String[]args); - - /** - * Run the MSG simulation, and cleanup everything afterward. - * - * If you want to chain simulations in the same process, you - * should call again createEnvironment and deployApplication afterward. - * - * @see MSG_run, MSG_clean - */ - public final static native void run() ; - - /** - * The native implemented method to create the environment of the simulation. - * - * @param platformFile The XML file which contains the description of the environment of the simulation - * - */ - public final static native void createEnvironment(String platformFile); - - /** - * The method to deploy the simulation. - * - * @param platformFile The XML file which contains the description of the application to deploy. - */ - public final static native void deployApplication(String deploymentFile); - - /** Example launcher. You can use it or provide your own launcher, as you wish */ - static public void main(String[]args) throws MsgException { - /* initialize the MSG simulation. Must be done before anything else (even logging). */ - Msg.init(args); - - if (args.length < 2) { - Msg.info("Usage: Msg platform_file deployment_file"); - System.exit(1); - } - - /* Load the platform and deploy the application */ - Msg.createEnvironment(args[0]); - Msg.deployApplication(args[1]); - /* Execute the simulation */ - Msg.run(); - } -} diff --git a/src/java/simgrid/msg/MsgException.java b/src/java/simgrid/msg/MsgException.java deleted file mode 100644 index c3591a81db..0000000000 --- a/src/java/simgrid/msg/MsgException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This exception is an abstract class grouping all MSG-related exceptions - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ -package simgrid.msg; - -/** - * This exception is an abstract class grouping all MSG-related exceptions - - \htmlonly \endhtmlonly - - */ -public abstract class MsgException extends Exception { - private static final long serialVersionUID = 1L; - - /** - * Constructs an MsgException without a - * detail message. - */ - public MsgException() { - super(); - } - /** - * Constructs an MsgException with a detail message. - * - * @param s the detail message. - */ - public MsgException(String s) { - super(s); - } -} diff --git a/src/java/simgrid/msg/MsgNative.java b/src/java/simgrid/msg/MsgNative.java deleted file mode 100644 index e7f7759a2d..0000000000 --- a/src/java/simgrid/msg/MsgNative.java +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Contains all the native methods related to Process, Host and Task. - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ - -package simgrid.msg; - -/* FIXME: split into internal classes of Msg, Task, Host etc. */ - -/** - * Contains all the native methods related to Process, Host and Task. - */ -final class MsgNative { - - /****************************************************************** - * The natively implemented methods connected to the MSG Process * - ******************************************************************/ - /** - * The natively implemented method to create an MSG process. - * - * @param process The java process object to bind with the MSG native process. - * @param host A valid (binded) host where create the process. - * - * @see Process constructors. - */ - final static native - void processCreate(Process process, Host host); - - /** - * The natively implemented method to kill all the process of the simulation. - * - * @param resetPID Should we reset the PID numbers. A negative number means no reset - * and a positive number will be used to set the PID of the next newly - * created process. - * - * @return The function returns the PID of the next created process. - */ - final static native int processKillAll(int resetPID); - - /** - * The natively implemented method to suspend an MSG process. - * - * @param process The valid (binded with a native process) java process to suspend. - * - * @see Process.pause() - */ - final static native void processSuspend(Process process); - - /** - * The natively implemented method to kill a MSG process. - * - * @param process The valid (binded with a native process) java process to kill. - * - * @see Process.kill() - */ - final static native void processKill(Process process); - - /** - * The natively implemented method to resume a suspended MSG process. - * - * @param process The valid (binded with a native process) java process to resume. - * - * - * @see Process.restart() - */ - final static native void processResume(Process process); - - /** - * The natively implemented method to test if MSG process is suspended. - * - * @param process The valid (binded with a native process) java process to test. - * - * @return If the process is suspended the method retuns true. Otherwise the - * method returns false. - * - * @see Process.isSuspended() - */ - final static native boolean processIsSuspended(Process process); - - /** - * The natively implemented method to get the host of a MSG process. - * - * @param process The valid (binded with a native process) java process to get the host. - * - * @return The method returns the host where the process is running. - * - * @exception HostNotFoundException if the SimGrid native code failed (initialization error?). - * - * @see Process.getHost() - */ - final static native Host processGetHost(Process process); - - /** - * The natively implemented method to get a MSG process from his PID. - * - * @param PID The PID of the process to get. - * - * @return The process with the specified PID. - * - * @see Process.getFromPID() - */ - final static native Process processFromPID(int PID) ; - - /** - * The natively implemented method to get the PID of a MSG process. - * - * @param process The valid (binded with a native process) java process to get the PID. - * - * @return The PID of the specified process. - * - * @see Process.getPID() - */ - final static native int processGetPID(Process process); - - /** - * The natively implemented method to get the PPID of a MSG process. - * - * @param process The valid (binded with a native process) java process to get the PID. - * - * @return The PPID of the specified process. - * - * @see Process.getPPID() - */ - final static native int processGetPPID(Process process); - - /** - * The natively implemented method to get the current running process. - * - * @return The current process. - * - * @see Process.currentProcess() - */ - final static native Process processSelf(); - - /** - * The natively implemented method to migrate a process from his currnet host to a new host. - * - * @param process The (valid) process to migrate. - * @param host A (valid) host where move the process. - * - * - * @see Process.migrate() - * @see Host.getByName() - */ - final static native void processChangeHost(Process process, Host host) ; - - /** - * The natively implemented native to request the current process to sleep - * until time seconds have elapsed. - * - * @param seconds The time the current process must sleep. - * - * @exception HostFailureException if the SimGrid native code failed. - * - * @see Process.waitFor() - */ - final static native void processWaitFor(double seconds) throws HostFailureException; - - /** - * The natively implemented native method to exit a process. - * - * @see Process.exit() - */ - final static native void processExit(Process process); - - - /****************************************************************** - * The natively implemented methods connected to the MSG host * - ******************************************************************/ - - /** - * The natively implemented method to get an host from his name. - * - * @param name The name of the host to get. - * - * @return The host having the specified name. - * - * @exception HostNotFoundException if there is no such host - * - * - * @see Host.getByName() - */ - final static native Host hostGetByName(String name) throws HostNotFoundException; - - /** - * The natively implemented method to get the name of an MSG host. - * - * @param host The host (valid) to get the name. - * - * @return The name of the specified host. - * - * @see Host.getName() - */ - final static native String hostGetName(Host host); - - /** - * The natively implemented method to get the number of hosts of the simulation. - * - * @return The number of hosts of the simulation. - * - * @see Host.getNumber() - */ - final static native int hostGetCount(); - - /** - * The natively implemented method to get the host of the current runing process. - * - * @return The host of the current running process. - * - * @see Host.currentHost() - */ - final static native Host hostSelf(); - - /** - * The natively implemented method to get the speed of a MSG host. - * - * @param host The host to get the host. - * - * @return The speed of the specified host. - * - * @see Host.getSpeed() - */ - - final static native double hostGetSpeed(Host host); - - /** - * The natively implemented native method to test if an host is avail. - * - * @param host The host to test. - * - * @return If the host is avail the method returns true. - * Otherwise the method returns false. - * - * @see Host.isAvail() - */ - final static native boolean hostIsAvail(Host host); - - /** - * The natively implemented native method to get all the hosts of the simulation. - * - * @return A array which contains all the hosts of simulation. - */ - - final static native Host[] allHosts(); - - /** - * The natively implemented native method to get the number of running tasks on a host. - * - * @param The host concerned by the operation. - * - * @return The number of running tasks. - */ - final static native int hostGetLoad(Host host); - - /****************************************************************** - * The natively implemented methods connected to the MSG task * - ******************************************************************/ - - /** - * The natively implemented method to create a MSG task. - * - * @param name The name of th task. - * @param computeDuration A value of the processing amount (in flop) needed - * to process the task. If 0, then it cannot be executed - * with the execute() method. This value has to be >= 0. - * @param messageSize A value of amount of data (in bytes) needed to transfert - * this task. If 0, then it cannot be transfered this task. - * If 0, then it cannot be transfered with the get() and put() - * methods. This value has to be >= 0. - * @param task The java task object to bind with the native task to create. - * - * @exception IllegalArgumentException if compute duration <0 or message size <0 - * - * @see Task.create() - */ - final static native void taskCreate(Task task, String name, - double computeDuration, - double messageSize) - throws IllegalArgumentException; - - /** - * The natively implemented method to get the sender of a task. - * - * @param task The task (valid) to get the sender. - * - * @return The sender of the task. - * - * @see Task.getSender() - */ - final static native Process taskGetSender(Task task); - - /** - * The natively implementd method to get the source of a task. - * - * @param task The task to get the source. - * - * @return The source of the task. - * - * - * @see Task.getSource() - */ - final static native Host taskGetSource(Task task); - - /** - * The natively implemented method to get the name of the task. - * - * @param task The task to get the name. - * - * @return The name of the specified task. - * - * @see Task.getName() - */ - final static native String taskGetName(Task task); - - /** - * The natively implemented method to cancel a task. - * - * @param task The task to cancel. - * - * - * @see Task.cancel(). - */ - final static native void taskCancel(Task task); - - /** - * The natively implemented method to create a MSG parallel task. - * - * @param name The name of the parallel task. - * @param hosts The list of hosts implied by the parallel task. - * @param computeDurations The total number of operations that have to be performed - * on the hosts. - * @param messageSizes An array of doubles - * - * @see ParallelTask.create() - */ - final static native void parallelTaskCreate(Task pTask, String name, - Host[]hosts, - double[]computeDurations, - double[]messageSizes) - throws NullPointerException, IllegalArgumentException; - - /** - * The natively implemented method to get the computing amount of the task. - * - * @param task The task to get the computing amount. - * - * @return The computing amount of the specified task. - * - * @see Task.getComputeDuration() - */ - final static native double taskGetComputeDuration(Task task); - - /** - * The natively implemented method to get the remaining computation - * - * @param task The task to get the remaining computation. - * - * @return The remaining computation of the specified task. - * - * @see Task.getRemainingDuration() - */ - final static native double taskGetRemainingDuration(Task task); - - /** - * The natively implemented method to set the priority of a task. - * - * @param task The task to set the priority - * - * @param priority The new priority of the specified task. - * - * @see Task.setPriority() - */ - final static native void taskSetPriority(Task task, double priority); - - /** - * The natively implemented method to destroy a MSG task. - * - * @param The task to destroy. - * - * - * @see Task.destroy() - */ - final static native void taskDestroy(Task task) ; - - /** - * The natively implemented method to execute a MSG task. - * - * @param task The task to execute. - * - * @exception HostFailureException,TaskCancelledException on error in the C world - * - * @see Task.execute() - */ - final static native void taskExecute(Task task) throws HostFailureException,TaskCancelledException; - - /* **************************************************************** - * Communication methods thru mailboxes * - **************************************************************** */ - - final static native void taskSend(String alias, Task task, double timeout) throws TransferFailureException,HostFailureException,TimeoutException; - final static native Task taskReceive(String alias, double timeout, Host host) throws TransferFailureException,HostFailureException,TimeoutException; - final static native int taskListenFrom(String alias); - final static native boolean taskListen(String alias); - final static native int taskListenFromHost(String alias, Host host); - - /* *************************************************************** - * Task sending methods * - *************************************************************** */ - - /** - * The natively implemented method to send a task in a mailbox associated with an alias, with a bounded transmition - * rate. - * - * @param alias The alias of the mailbox. - * @param task The task to put. - * @param max_rate The bounded transmition rate. - * - * @exception NativeException on error in the C world - */ - final static native void taskSendBounded(String alias, Task task, double maxrate) throws TransferFailureException,HostFailureException,TimeoutException; - -} diff --git a/src/java/simgrid/msg/NativeException.java b/src/java/simgrid/msg/NativeException.java deleted file mode 100644 index deffee5732..0000000000 --- a/src/java/simgrid/msg/NativeException.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This exception is raised when there is an error within the C world of SimGrid. - * - * Copyright 2006,2007,2010 The SimGrid team - * All right 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. - */ -package simgrid.msg; - -/** - * This exception is raised when there is an error within the C world of SimGrid. - * Refer to the string message for more info on what went wrong. - */ -public class NativeException extends MsgException { - private static final long serialVersionUID = 1L; - - /** - * Constructs an NativeException with a detail message. - * - * @param s the detail message. - */ - public NativeException(String s) { - super(s); - } -} diff --git a/src/java/simgrid/msg/Process.java b/src/java/simgrid/msg/Process.java deleted file mode 100644 index 8d2b2ca0a8..0000000000 --- a/src/java/simgrid/msg/Process.java +++ /dev/null @@ -1,380 +0,0 @@ -/* - * $Id$ - * - * Copyright 2006,2007 Martin Quinson, Malek Cherier - * All right 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. - */ - -package simgrid.msg; - -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; - -/** - * A process may be defined as a code, with some private data, executing - * in a location (host). All the process used by your simulation must be - * declared in the deployment file (XML format). - * To create your own process you must inherit your own process from this - * class and override the method "main()". For example if you want to use - * a process named Slave proceed as it : - * - * (1) import the class Process of the package simgrid.msg - * import simgrid.msg.Process; - * - * public class Slave extends simgrid.msg.Process { - * - * (2) Override the method function - * - * \verbatim - * public void main(String[] args) { - * System.out.println("Hello MSG"); - * } - * \endverbatim - * } - * The name of your process must be declared in the deployment file of your simulation. - * For the example, for the previous process Slave this file must contains a line : - * <process host="Maxims" function="Slave"/>, where Maxims is the host of the process - * Slave. All the process of your simulation are automatically launched and managed by Msg. - * A process use tasks to simulate communications or computations with another process. - * For more information see Task. For more information on host concept - * see Host. - * - */ - -public abstract class Process extends Thread { - /** - * This attribute represents a bind between a java process object and - * a native process. Even if this attribute is public you must never - * access to it. It is set automatically during the build of the object. - */ - public long bind; - - /** - * Even if this attribute is public you must never access to it. - * It is used to compute the id of an MSG process. - */ - public static long nextProcessId = 0; - - /** - * Even if this attribute is public you must never access to it. - * It is compute automatically during the creation of the object. - * The native functions use this identifier to synchronize the process. - */ - public long id; - - public Hashtable properties; - - /** - * The name of the process. - */ - protected String name; - public String msgName() { - return this.name; - } - /** The arguments of the method function of the process. */ - public Vector args; - - /* process synchronization tools */ - protected Sem schedBegin, schedEnd; - - /** - * Default constructor (used in ApplicationHandler to initialize it) - */ - protected Process() { - super(); - this.id = nextProcessId++; - this.name = null; - this.bind = 0; - this.args = new Vector(); - this.properties = null; - schedBegin = new Sem(0); - schedEnd = new Sem(0); - } - - - /** - * Constructs a new process from the name of a host and his name. The method - * function of the process doesn't have argument. - * - * @param hostname The name of the host of the process to create. - * @param name The name of the process. - * - * @exception HostNotFoundException if no host with this name exists. - * - * - */ - public Process(String hostname, String name) throws HostNotFoundException { - this(Host.getByName(hostname), name, null); - } - /** - * Constructs a new process from the name of a host and his name. The arguments - * of the method function of the process are specified by the parameter args. - * - * @param hostname The name of the host of the process to create. - * @param name The name of the process. - * @param args The arguments of the main function of the process. - * - * @exception HostNotFoundException if no host with this name exists. - * NativeException - * - */ - public Process(String hostname, String name, String args[]) throws HostNotFoundException, NativeException { - this(Host.getByName(hostname), name, args); - } - /** - * Constructs a new process from a host and his name. The method function of the - * process doesn't have argument. - * - * @param host The host of the process to create. - * @param name The name of the process. - * - */ - public Process(Host host, String name) { - this(host, name, null); - } - /** - * Constructs a new process from a host and his name, the arguments of here method function are - * specified by the parameter args. - * - * @param host The host of the process to create. - * @param name The name of the process. - * @param args The arguments of main method of the process. - * - */ - public Process(Host host, String name, String[]args) { - /* This is the constructor called by all others */ - this(); - - if (name == null) - throw new NullPointerException("Process name cannot be NULL"); - this.name = name; - - this.args = new Vector(); - if (null != args) - this.args.addAll(Arrays.asList(args)); - - MsgNative.processCreate(this, host); - } - - - /** - * This method kills all running process of the simulation. - * - * @param resetPID Should we reset the PID numbers. A negative number means no reset - * and a positive number will be used to set the PID of the next newly - * created process. - * - * @return The function returns the PID of the next created process. - * - */ - public static int killAll(int resetPID) { - return MsgNative.processKillAll(resetPID); - } - - /** - * This method adds an argument in the list of the arguments of the main function - * of the process. - * - * @param arg The argument to add. - */ - @Deprecated - protected void addArg(String arg) { - args.add(arg); - } - - /** - * Suspends the process by suspending the task on which it was - * waiting for the completion. - * - */ - public void pause() { - MsgNative.processSuspend(this); - } - /** - * Resumes a suspended process by resuming the task on which it was - * waiting for the completion. - * - * - */ - public void restart() { - MsgNative.processResume(this); - } - /** - * Tests if a process is suspended. - * - * @return The method returns true if the process is suspended. - * Otherwise the method returns false. - */ - public boolean isSuspended() { - return MsgNative.processIsSuspended(this); - } - /** - * Returns the host of a process. - * - * @return The host instance of the process. - * - * @exception NativeException on error in the native SimGrid code - * - */ - public Host getHost() { - return MsgNative.processGetHost(this); - } - /** - * This static method gets a process from a PID. - * - * @param PID The process identifier of the process to get. - * - * @return The process with the specified PID. - * - * @exception NativeException on error in the native SimGrid code - */ - public static Process fromPID(int PID) throws NativeException { - return MsgNative.processFromPID(PID); - } - /** - * This method returns the PID of the process. - * - * @return The PID of the process. - * - */ - public int getPID() { - return MsgNative.processGetPID(this); - } - /** - * This method returns the PID of the parent of a process. - * - * @return The PID of the parent of the process. - * - */ - public int getPPID() { - return MsgNative.processGetPPID(this); - } - /** - * This static method returns the currently running process. - * - * @return The current process. - * - */ - public static Process currentProcess() { - return MsgNative.processSelf(); - } - /** - * Migrates a process to another host. - * - * @param host The host where to migrate the process. - * - */ - public void migrate(Host host) { - MsgNative.processChangeHost(this, host); - } - /** - * Makes the current process sleep until time seconds have elapsed. - * - * @param seconds The time the current process must sleep. - * - * @exception HostFailureException on error in the native SimGrid code - */ - public static void waitFor(double seconds) throws HostFailureException { - MsgNative.processWaitFor(seconds); - } - public void showArgs() { - Msg.info("[" + this.name + "/" + this.getHost().getName() + "] argc=" + - this.args.size()); - for (int i = 0; i < this.args.size(); i++) - Msg.info("[" + this.msgName() + "/" + this.getHost().getName() + - "] args[" + i + "]=" + (String) (this.args.get(i))); - } - /** - * This method runs the process. Il calls the method function that you must overwrite. - */ - public void run() { - - String[]args = null; /* do not fill it before the signal or this.args will be empty */ - - //waitSignal(); /* wait for other people to fill the process in */ - - - try { - schedBegin.acquire(); - } catch(InterruptedException e) { - } - - try { - args = new String[this.args.size()]; - if (this.args.size() > 0) { - this.args.toArray(args); - } - - this.main(args); - MsgNative.processExit(this); - schedEnd.release(); - } catch(MsgException e) { - e.printStackTrace(); - Msg.info("Unexpected behavior. Stopping now"); - System.exit(1); - } - } - - /** - * The main function of the process (to implement). - */ - public abstract void main(String[]args) throws MsgException; - - - public void unschedule() { - try { - schedEnd.release(); - schedBegin.acquire(); - } catch(InterruptedException e) { - } - } - - public void schedule() { - try { - schedBegin.release(); - schedEnd.acquire(); - } catch(InterruptedException e) { - } - } - - /** Send the given task in the mailbox associated with the specified alias (waiting at most given time) - * @throws TimeoutException - * @throws HostFailureException - * @throws TransferFailureException */ - public void taskSend(String mailbox, Task task, double timeout) throws TransferFailureException, HostFailureException, TimeoutException { - MsgNative.taskSend(mailbox, task, timeout); - } - - /** Send the given task in the mailbox associated with the specified alias - * @throws TimeoutException - * @throws HostFailureException - * @throws TransferFailureException */ - public void taskSend(String mailbox, Task task) throws TransferFailureException, HostFailureException, TimeoutException { - MsgNative.taskSend(mailbox, task, -1); - } - - /** Receive a task on mailbox associated with the specified mailbox */ - public Task taskReceive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException { - return MsgNative.taskReceive(mailbox, -1.0, null); - } - - /** Receive a task on mailbox associated with the specified alias (waiting at most given time) */ - public Task taskReceive(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException { - return MsgNative.taskReceive(mailbox, timeout, null); - } - - /** Receive a task on mailbox associated with the specified alias from given sender */ - public Task taskReceive(String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException { - return MsgNative.taskReceive(mailbox, timeout, host); - } - - /** Receive a task on mailbox associated with the specified alias from given sender*/ - public Task taskReceive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException { - return MsgNative.taskReceive(mailbox, -1.0, host); - } -} diff --git a/src/java/simgrid/msg/ProcessNotFoundException.java b/src/java/simgrid/msg/ProcessNotFoundException.java deleted file mode 100644 index e3c7df8e09..0000000000 --- a/src/java/simgrid/msg/ProcessNotFoundException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This exception is raised when looking for a non-existing process. - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ - -package simgrid.msg; - -/** - * This exception is raised when looking for a non-existing process. - */ -public class ProcessNotFoundException extends MsgException { - private static final long serialVersionUID = 1L; - - /** - * Constructs an ProcessNotFoundException without a - * detail message. - */ - public ProcessNotFoundException() { - super(); - } - /** - * Constructs an ProcessNotFoundException with a detail message. - * - * @param s the detail message. - */ - public ProcessNotFoundException(String s) { - super(s); - } -} diff --git a/src/java/simgrid/msg/Sem.java b/src/java/simgrid/msg/Sem.java deleted file mode 100644 index af1d60bf83..0000000000 --- a/src/java/simgrid/msg/Sem.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Simple semaphore implementation, from Doug Lea (public domain) - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ - package simgrid.msg; - public class Sem { - /******************************************************************/ - /* Simple semaphore implementation, from Doug Lea (public domain) */ - /******************************************************************/ - private int permits_; - public Sem(int i) { permits_ = i; } public void acquire() throws InterruptedException { - if (Thread.interrupted()) - throw new InterruptedException(); - synchronized(this) { - try { - while (permits_ <= 0) - wait(); - --permits_; - } - catch(InterruptedException ex) { - notify(); - throw ex; - } - } - } - public synchronized void release() { - ++(this.permits_); - notify(); - } } diff --git a/src/java/simgrid/msg/Task.java b/src/java/simgrid/msg/Task.java deleted file mode 100644 index bc2cdaa23b..0000000000 --- a/src/java/simgrid/msg/Task.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * simgrid.msg.Task.java 1.00 07/05/01 - * - * Copyright 2006,2007 Martin Quinson, Malek Cherier - * All right 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. - */ - -package simgrid.msg; - -/** - * A task is either something to compute somewhere, or something to exchange between two hosts (or both). - * It is defined by a computing amount and a message size. - * - */ -public class Task { - /** - * This attribute represents a bind between a java task object and - * a native task. Even if this attribute is public you must never - * access to it. It is set automatically during the build of the object. - */ - public long bind = 0; - - - /** Default constructor (all fields to 0 or null) */ - public Task() { - MsgNative.taskCreate(this, null, 0, 0); - } - /* * * * - * * Constructors * * - * * * */ - /** - * Construct an new task with the specified processing amount and amount - * of data needed. - * - * @param name Task's name - * - * @param computeDuration A value of the processing amount (in flop) needed to process the task. - * If 0, then it cannot be executed with the execute() method. - * This value has to be >= 0. - * - * @param messageSize A value of amount of data (in bytes) needed to transfert this task. - * If 0, then it cannot be transfered with the get() and put() methods. - * This value has to be >= 0. - */ - public Task(String name, double computeDuration, double messageSize) { - MsgNative.taskCreate(this, name, computeDuration, messageSize); - } - /** - * Construct an new parallel task with the specified processing amount and amount for each host - * implied. - * - * @param name The name of the parallel task. - * @param hosts The list of hosts implied by the parallel task. - * @param computeDurations The amount of operations to be performed by each host of \a hosts. - * @param messageSizes A matrix describing the amount of data to exchange between hosts. - */ - public Task(String name, Host[]hosts, double[]computeDurations, double[]messageSizes) { - MsgNative.parallelTaskCreate(this, name, hosts, computeDurations, messageSizes); - } - /* * * * - * * Getters / Setters * * - * * * */ - /** Gets the name of a task */ - public String getName() { - return MsgNative.taskGetName(this); - } - /** Gets the sender of the task */ - Process getSender() { - return MsgNative.taskGetSender(this); - } - /** Gets the source of the task */ - public Host getSource() { - return MsgNative.taskGetSource(this); - } - /** Gets the computing amount of the task */ - public double getComputeDuration() { - return MsgNative.taskGetComputeDuration(this); - } - /** Gets the remaining computation of the task */ - public double getRemainingDuration() { - return MsgNative.taskGetRemainingDuration(this); - } - /** - * This method sets the priority of the computation of the task. - * The priority doesn't affect the transfert rate. For example a - * priority of 2 will make the task receive two times more cpu than - * the other ones. - * - * @param priority The new priority of the task. - */ - public void setPriority(double priority) { - MsgNative.taskSetPriority(this, priority); - } - /* * * * - * * Communication-related * * - * * * */ - - - /* * * * - * * Computation-related * * - * * * */ - /** - * Executes a task on the location on which the process is running. - * - * @exception HostFailureException,TaskCancelledException - */ - public void execute() throws HostFailureException,TaskCancelledException { - MsgNative.taskExecute(this); - } - /** - * Cancels a task. - * - * @exception NativeException if the cancellation failed. - */ - public void cancel() { - MsgNative.taskCancel(this); - } - /** Deletes a task. - * - * @exception NativeException if the destruction failed. - */ - protected void finalize() throws NativeException { - if (this.bind != 0) - MsgNative.taskDestroy(this); - } - - /** - * Sends the task on the mailbox identified by the specified name - * - * @throws TimeoutException - * @throws HostFailureException - * @throws TransferFailureException - */ - public void send(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException { - MsgNative.taskSend(mailbox, this, -1); - } - - /** - * Sends the task on the mailbox identified by the specified name (wait at most \a timeout seconds) - * - * @exception NativeException if the retrieval fails. - * @throws TimeoutException - * @throws HostFailureException - * @throws TransferFailureException - */ - public void send(String mailbox, double timeout) throws NativeException, TransferFailureException, HostFailureException, TimeoutException { - MsgNative.taskSend(mailbox, this, timeout); - } - - /** - * Sends the task on the mailbox identified by the specified alias (capping the sending rate to \a maxrate) - * - * @exception TransferFailureException, HostFailureException, TimeoutException. - */ - public void sendBounded(String alias, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException { - MsgNative.taskSendBounded(alias, this, maxrate); - } - - /** - * Retrieves next task from the mailbox identified by the specified name - * - * @exception TransferFailureException, HostFailureException, TimeoutException if the retrieval fails. - */ - - public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException { - return MsgNative.taskReceive(mailbox, -1.0, null); - } - - /** - * Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds) - * - * @exception TransferFailureException, HostFailureException, TimeoutException if the retrieval fails. - */ - public static Task receive(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException { - return MsgNative.taskReceive(mailbox, timeout, null); - } - - /** - * Retrieves next task sent by a given host on the mailbox identified by the specified alias - * - * @exception TransferFailureException, HostFailureException, TimeoutException if the retrieval fails. - */ - - public static Task receive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException { - return MsgNative.taskReceive(mailbox, -1.0, host); - } - - /** - * Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds) - * - * @exception TransferFailureException, HostFailureException, TimeoutException if the retrieval fails. - */ - public static Task receive(String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException { - return MsgNative.taskReceive(mailbox, timeout, host); - } - - /** - * Tests whether there is a pending communication on the mailbox identified by the specified alias, and who sent it - * - */ - public static int listenFrom(String mailbox) { - return MsgNative.taskListenFrom(mailbox); - } - /** - * Listen whether there is a waiting task on the mailbox identified by the specified alias - * - */ - public static boolean listen(String mailbox) { - return MsgNative.taskListen(mailbox); - } - - /** - * Counts the number of tasks waiting to be received on the \a mailbox identified by the specified alia and sended by the specified \a host. - * - */ - public static int listenFromHost(String alias, Host host) { - return MsgNative.taskListenFromHost(alias, host); - } -} diff --git a/src/java/simgrid/msg/TaskCancelledException.java b/src/java/simgrid/msg/TaskCancelledException.java deleted file mode 100644 index 7c11d2a0b5..0000000000 --- a/src/java/simgrid/msg/TaskCancelledException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This exception is raised when looking for a non-existing host. - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ - -package simgrid.msg; - -/** - * This exception is raised when task is cancelled. - */ -public class TaskCancelledException extends MsgException { - private static final long serialVersionUID = 1L; - - /** Constructs an TaskCancelledException without a detail message. */ - public TaskCancelledException() { - super(); - } - /** - * Constructs an TaskCancelledException with a detail message. - * - * @param s the detail message. - */ - public TaskCancelledException(String s) { - super(s); - } -} diff --git a/src/java/simgrid/msg/TimeoutException.java b/src/java/simgrid/msg/TimeoutException.java deleted file mode 100644 index bd6a115891..0000000000 --- a/src/java/simgrid/msg/TimeoutException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This exception is raised when looking for a non-existing host. - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ - -package simgrid.msg; - -/** - * This exception is raised when time's out while sending tasks. - */ -public class TimeoutException extends MsgException { - private static final long serialVersionUID = 1L; - - /** Constructs an TimeoutFailureException without a detail message. */ - public TimeoutException() { - super(); - } - /** - * Constructs an TransferFailureException with a detail message. - * - * @param s the detail message. - */ - public TimeoutException(String s) { - super(s); - } -} diff --git a/src/java/simgrid/msg/TransferFailureException.java b/src/java/simgrid/msg/TransferFailureException.java deleted file mode 100644 index e1f90cd5a7..0000000000 --- a/src/java/simgrid/msg/TransferFailureException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This exception is raised when looking for a non-existing host. - * - * Copyright 2006,2007,2010 The SimGrid Team - * All right 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. - */ - -package simgrid.msg; - -/** - * This exception is raised if transfer failed while sending tasks. - */ -public class TransferFailureException extends MsgException { - private static final long serialVersionUID = 1L; - - /** Constructs an TransferFailureException without a detail message. */ - public TransferFailureException() { - super(); - } - /** - * Constructs an TransferFailureException with a detail message. - * - * @param s the detail message. - */ - public TransferFailureException(String s) { - super(s); - } -} -- 2.20.1