Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mutualExclusion -> app/centralizedmutex
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 1 Apr 2016 06:44:36 +0000 (08:44 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 1 Apr 2016 06:44:36 +0000 (08:44 +0200)
13 files changed:
.gitignore
examples/java/CMakeLists.txt
examples/java/app/centralizedmutex/Coordinator.java [moved from examples/java/mutualExclusion/Coordinator.java with 98% similarity]
examples/java/app/centralizedmutex/GrantTask.java [moved from examples/java/mutualExclusion/GrantTask.java with 91% similarity]
examples/java/app/centralizedmutex/Main.java [moved from examples/java/mutualExclusion/MutexCentral.java with 51% similarity]
examples/java/app/centralizedmutex/Node.java [moved from examples/java/mutualExclusion/Node.java with 97% similarity]
examples/java/app/centralizedmutex/ReleaseTask.java [moved from examples/java/mutualExclusion/ReleaseTask.java with 91% similarity]
examples/java/app/centralizedmutex/RequestTask.java [moved from examples/java/mutualExclusion/RequestTask.java with 93% similarity]
examples/java/app/centralizedmutex/app_centralizedmutex.tesh [new file with mode: 0644]
examples/java/app/centralizedmutex/centralizedmutex.xml [moved from examples/java/mutualExclusion/mutex_centralized_deployment.xml with 68% similarity]
examples/java/mutualExclusion/CMakeLists.txt [deleted file]
examples/java/mutualExclusion/mutualexclusion.tesh [deleted file]
tools/cmake/DefinePackages.cmake

index edf1f9f..842f801 100644 (file)
@@ -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
index 64bc33c..76ff8c9 100644 (file)
@@ -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()
@@ -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;
@@ -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 {}
@@ -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();
similarity index 97%
rename from examples/java/mutualExclusion/Node.java
rename to examples/java/app/centralizedmutex/Node.java
index 353dfd7..b8fd1d1 100644 (file)
@@ -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;
@@ -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 {}
@@ -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 (file)
index 0000000..feaf851
--- /dev/null
@@ -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...
@@ -1,14 +1,14 @@
 <?xml version='1.0'?>
 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
 <platform version="4">
-  <process host="Tremblay" function="mutualExclusion.Coordinator">
+  <process host="Tremblay" function="app.centralizedmutex.Coordinator">
     <argument value="2"/> <!-- Amount of CS to serve -->
   </process>
-  <process host="Jupiter" function="mutualExclusion.Node">
+  <process host="Jupiter" function="app.centralizedmutex.Node">
     <argument value="2"/> <!-- initial sleep time -->
     <argument value="5"/> <!-- CS time -->
   </process>
-  <process host="Fafard" function="mutualExclusion.Node">
+  <process host="Fafard" function="app.centralizedmutex.Node">
     <argument value="2"/> <!-- initial sleep time -->
     <argument value="5"/> <!-- CS time -->
   </process>
diff --git a/examples/java/mutualExclusion/CMakeLists.txt b/examples/java/mutualExclusion/CMakeLists.txt
deleted file mode 100644 (file)
index a5e9bed..0000000
+++ /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 (file)
index 1c03a20..0000000
+++ /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...
index 0f2c9df..8064f22 100644 (file)
@@ -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