From: Frederic Suter Date: Fri, 1 Apr 2016 06:44:36 +0000 (+0200) Subject: mutualExclusion -> app/centralizedmutex X-Git-Tag: v3_13~180^2~12^2~8 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f42642e426356bfe613de46681bdde3ac1b9d5fd mutualExclusion -> app/centralizedmutex --- diff --git a/.gitignore b/.gitignore index edf1f9f850..842f801601 100644 --- a/.gitignore +++ b/.gitignore @@ -971,6 +971,7 @@ tools/tesh/tesh ######################################### ## touched files to track the dependencies of java examples examples/java/app/bittorrent/java_app_bittorrent_compiled +examples/java/app/centralizedmutex/java_app_centralizedmutex_compiled examples/java/app/masterworker/java_app_masterworker_compiled examples/java/async/java_async_compiled examples/java/dht/chord/java_dht_chord_compiled @@ -984,7 +985,6 @@ examples/java/io/storage/java_io_storage_compiled examples/java/process/kill/java_process_kill_compiled examples/java/process/migration/java_process_migration_compiled examples/java/process/suspend/java_process_suspend_compiled -examples/java/mutualExclusion/java_mutualExclusion_compiled examples/java/pingPong/java_pingPong_compiled examples/java/priority/java_priority_compiled examples/java/process/startkilltime/java_process_startkilltime_compiled diff --git a/examples/java/CMakeLists.txt b/examples/java/CMakeLists.txt index 64bc33c7b7..76ff8c9af8 100644 --- a/examples/java/CMakeLists.txt +++ b/examples/java/CMakeLists.txt @@ -3,6 +3,10 @@ set(app_bittorrent_sources ${srcdir}/Main.java ${srcdir}/Common.java ${srcd ${srcdir}/MessageTask.java ${srcdir}/Peer.java ${srcdir}/Tracker.java ${srcdir}/TrackerTask.java) +set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex) +set(app_centralizedmutex_sources ${srcdir}/Main.java ${srcdir}/Coordinator.java ${srcdir}/GrantTask.java + ${srcdir}/Node.java ${srcdir}/ReleaseTask.java ${srcdir}/RequestTask.java) + set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker) set(app_masterworker_sources ${srcdir}/Main.java ${srcdir}/Master.java ${srcdir}/Worker.java) @@ -49,9 +53,9 @@ set(process_startkilltime_sources ${srcdir}/Main.java ${srcdir}/Sleeper.java) set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend) set(process_suspend_sources ${srcdir}/Main.java ${srcdir}/DreamMaster.java ${srcdir}/LazyGuy.java) -foreach (example app_bittorrent app_masterworker cloud_migration cloud_masterworker dht_chord dht_kademlia - energy_consumption energy_vm io_file io_storage process_kill process_migration process_startkilltime - process_suspend) +foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker + dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration + process_startkilltime process_suspend) string (REPLACE "_" "/" example_dir ${example}) if(enable_java) add_custom_command( @@ -75,15 +79,16 @@ set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/ge set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/README ${CMAKE_CURRENT_SOURCE_DIR}/cloud/migration PARENT_SCOPE) set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml + ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex/centralizedmutex.xml ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml PARENT_SCOPE) if(enable_java) - foreach (example app_bittorrent app_masterworker cloud_migration cloud_masterworker dht_chord dht_kademlia - energy_consumption energy_vm io_file io_storage process_kill process_migration process_startkilltime - process_suspend) + foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker + dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration + process_startkilltime process_suspend) string (REPLACE "_" "/" example_dir ${example}) ADD_TESH(java-${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh) endforeach() diff --git a/examples/java/mutualExclusion/Coordinator.java b/examples/java/app/centralizedmutex/Coordinator.java similarity index 98% rename from examples/java/mutualExclusion/Coordinator.java rename to examples/java/app/centralizedmutex/Coordinator.java index f605279144..f89fef94f4 100644 --- a/examples/java/mutualExclusion/Coordinator.java +++ b/examples/java/app/centralizedmutex/Coordinator.java @@ -4,7 +4,7 @@ /* 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 mutualExclusion; +package app.centralizedmutex; import java.util.LinkedList; import org.simgrid.msg.Msg; diff --git a/examples/java/mutualExclusion/GrantTask.java b/examples/java/app/centralizedmutex/GrantTask.java similarity index 91% rename from examples/java/mutualExclusion/GrantTask.java rename to examples/java/app/centralizedmutex/GrantTask.java index fb405a908d..ff21e2a90a 100644 --- a/examples/java/mutualExclusion/GrantTask.java +++ b/examples/java/app/centralizedmutex/GrantTask.java @@ -4,5 +4,5 @@ /* 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 mutualExclusion; +package app.centralizedmutex; public class GrantTask extends org.simgrid.msg.Task {} diff --git a/examples/java/mutualExclusion/MutexCentral.java b/examples/java/app/centralizedmutex/Main.java similarity index 51% rename from examples/java/mutualExclusion/MutexCentral.java rename to examples/java/app/centralizedmutex/Main.java index ef1fc02dda..7a8a7ac2eb 100644 --- a/examples/java/mutualExclusion/MutexCentral.java +++ b/examples/java/app/centralizedmutex/Main.java @@ -4,25 +4,21 @@ /* 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 mutualExclusion; +package app.centralizedmutex; import org.simgrid.msg.Msg; import org.simgrid.msg.NativeException; -public class MutexCentral { +public class Main { public static void main(String[] args) throws NativeException { Msg.init(args); - if(args.length < 2) { - Msg.info("Usage: MutexCentral platform_file deployment_file"); - Msg.info("Fallback to default values"); - Msg.createEnvironment("../platform/small_platform.xml"); - Msg.deployApplication("mutex_centralized_deployment.xml"); - } else { - /* construct the platform and deploy the application */ - Msg.createEnvironment(args[0]); - Msg.deployApplication(args[1]); - } + String platf = args.length > 1 ? args[0] : "../platforms/small_platform.xml"; + String deploy = args.length > 1 ? args[1] : "./centralizedmutex.xml"; + + /* construct the platform and deploy the application */ + Msg.createEnvironment(platf); + Msg.deployApplication(deploy); /* execute the simulation. */ Msg.run(); diff --git a/examples/java/mutualExclusion/Node.java b/examples/java/app/centralizedmutex/Node.java similarity index 97% rename from examples/java/mutualExclusion/Node.java rename to examples/java/app/centralizedmutex/Node.java index 353dfd7947..b8fd1d1f95 100644 --- a/examples/java/mutualExclusion/Node.java +++ b/examples/java/app/centralizedmutex/Node.java @@ -4,7 +4,7 @@ /* 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 mutualExclusion; +package app.centralizedmutex; import org.simgrid.msg.Msg; import org.simgrid.msg.Host; diff --git a/examples/java/mutualExclusion/ReleaseTask.java b/examples/java/app/centralizedmutex/ReleaseTask.java similarity index 91% rename from examples/java/mutualExclusion/ReleaseTask.java rename to examples/java/app/centralizedmutex/ReleaseTask.java index 2a0e020e33..ebc2286b8d 100644 --- a/examples/java/mutualExclusion/ReleaseTask.java +++ b/examples/java/app/centralizedmutex/ReleaseTask.java @@ -4,5 +4,5 @@ /* 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 mutualExclusion; +package app.centralizedmutex; public class ReleaseTask extends org.simgrid.msg.Task {} diff --git a/examples/java/mutualExclusion/RequestTask.java b/examples/java/app/centralizedmutex/RequestTask.java similarity index 93% rename from examples/java/mutualExclusion/RequestTask.java rename to examples/java/app/centralizedmutex/RequestTask.java index 1b86e4b874..adfc3a78ae 100644 --- a/examples/java/mutualExclusion/RequestTask.java +++ b/examples/java/app/centralizedmutex/RequestTask.java @@ -4,7 +4,7 @@ /* 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 mutualExclusion; +package app.centralizedmutex; import org.simgrid.msg.Task; public class RequestTask extends Task { diff --git a/examples/java/app/centralizedmutex/app_centralizedmutex.tesh b/examples/java/app/centralizedmutex/app_centralizedmutex.tesh new file mode 100644 index 0000000000..feaf851cd8 --- /dev/null +++ b/examples/java/app/centralizedmutex/app_centralizedmutex.tesh @@ -0,0 +1,14 @@ +#! tesh + +! output sort 19 + +$ java -classpath ${classpath:=.} app/centralizedmutex/Main ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/app/centralizedmutex/centralizedmutex.xml +> [0.000000] [jmsg/INFO] Using regular java threads. +> [Jupiter:app.centralizedmutex.Node:(2) 0.000000] [jmsg/INFO] Send a request to the coordinator +> [Fafard:app.centralizedmutex.Node:(3) 0.000000] [jmsg/INFO] Send a request to the coordinator +> [Tremblay:app.centralizedmutex.Coordinator:(1) 0.019014] [jmsg/INFO] Got a request from app.centralizedmutex.Node. Queue empty: grant it +> [Jupiter:app.centralizedmutex.Node:(2) 0.019014] [jmsg/INFO] Wait for a grant from the coordinator +> [Fafard:app.centralizedmutex.Node:(3) 0.063737] [jmsg/INFO] Wait for a grant from the coordinator +> [Tremblay:app.centralizedmutex.Coordinator:(1) 0.063737] [jmsg/INFO] Got a request from app.centralizedmutex.Node. Queue empty: grant it +> [Tremblay:app.centralizedmutex.Coordinator:(1) 0.134167] [jmsg/INFO] we should shutdown the simulation now +> [0.134167] [jmsg/INFO] MSG_main finished; Cleaning up the simulation... diff --git a/examples/java/mutualExclusion/mutex_centralized_deployment.xml b/examples/java/app/centralizedmutex/centralizedmutex.xml similarity index 68% rename from examples/java/mutualExclusion/mutex_centralized_deployment.xml rename to examples/java/app/centralizedmutex/centralizedmutex.xml index 0f92c3053f..4d4bcb8e9d 100644 --- a/examples/java/mutualExclusion/mutex_centralized_deployment.xml +++ b/examples/java/app/centralizedmutex/centralizedmutex.xml @@ -1,14 +1,14 @@ - + - + - + diff --git a/examples/java/mutualExclusion/CMakeLists.txt b/examples/java/mutualExclusion/CMakeLists.txt deleted file mode 100644 index a5e9bed788..0000000000 --- a/examples/java/mutualExclusion/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -set(example java_mutualExclusion) -set(sources ${CMAKE_CURRENT_SOURCE_DIR}/Coordinator.java ${CMAKE_CURRENT_SOURCE_DIR}/GrantTask.java - ${CMAKE_CURRENT_SOURCE_DIR}/MutexCentral.java ${CMAKE_CURRENT_SOURCE_DIR}/Node.java - ${CMAKE_CURRENT_SOURCE_DIR}/ReleaseTask.java ${CMAKE_CURRENT_SOURCE_DIR}/RequestTask.java) - -if(enable_java) - add_custom_command( - COMMENT "Building ${example}..." - OUTPUT ${example}_compiled - DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR} - COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources} - COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled - COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled - ) - add_custom_target(${example} ALL DEPENDS ${example}_compiled) - ADD_TESH(java-mutualExclusion --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/mutualExclusion/mutualexclusion.tesh) -endif() - -set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/mutualexclusion.tesh PARENT_SCOPE) -set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/mutex_centralized_deployment.xml PARENT_SCOPE) -set(examples_src ${examples_src} ${sources} PARENT_SCOPE) diff --git a/examples/java/mutualExclusion/mutualexclusion.tesh b/examples/java/mutualExclusion/mutualexclusion.tesh deleted file mode 100644 index 1c03a20da3..0000000000 --- a/examples/java/mutualExclusion/mutualexclusion.tesh +++ /dev/null @@ -1,14 +0,0 @@ -#! tesh - -! output sort 19 - -$ java -classpath ${classpath:=.} mutualExclusion/MutexCentral ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/mutualExclusion/mutex_centralized_deployment.xml -> [0.000000] [jmsg/INFO] Using regular java threads. -> [Jupiter:mutualExclusion.Node:(2) 0.000000] [jmsg/INFO] Send a request to the coordinator -> [Fafard:mutualExclusion.Node:(3) 0.000000] [jmsg/INFO] Send a request to the coordinator -> [Tremblay:mutualExclusion.Coordinator:(1) 0.019014] [jmsg/INFO] Got a request from mutualExclusion.Node. Queue empty: grant it -> [Jupiter:mutualExclusion.Node:(2) 0.019014] [jmsg/INFO] Wait for a grant from the coordinator -> [Fafard:mutualExclusion.Node:(3) 0.063737] [jmsg/INFO] Wait for a grant from the coordinator -> [Tremblay:mutualExclusion.Coordinator:(1) 0.063737] [jmsg/INFO] Got a request from mutualExclusion.Node. Queue empty: grant it -> [Tremblay:mutualExclusion.Coordinator:(1) 0.134167] [jmsg/INFO] we should shutdown the simulation now -> [0.134167] [jmsg/INFO] MSG_main finished; Cleaning up the simulation... diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 0f2c9df231..8064f22d28 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -925,7 +925,6 @@ set(txt_files set(CMAKEFILES_TXT examples/java/CMakeLists.txt examples/java/async/CMakeLists.txt - examples/java/mutualExclusion/CMakeLists.txt examples/java/pingPong/CMakeLists.txt examples/java/priority/CMakeLists.txt examples/java/tracing/CMakeLists.txt