Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sort storages before listing.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 20 Aug 2017 12:04:50 +0000 (14:04 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 20 Aug 2017 12:04:50 +0000 (14:04 +0200)
examples/java/io/storage/Client.java

index 480ff86..2239ffb 100644 (file)
@@ -15,6 +15,8 @@
 
 package io.storage;
 
+import java.util.Arrays;
+import java.util.Comparator;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.Process;
@@ -30,6 +32,11 @@ public class Client extends Process {
    // Retrieve all mount points of current host
     Storage[] storages = getHost().getMountedStorage();
 
+    Arrays.sort(storages, new Comparator<Storage>() {
+        public int compare(Storage a, Storage b) {
+          return a.getName().compareTo(b.getName());
+        }
+      });
     for (int i = 0; i < storages.length; i++) {
       // For each disk mounted on host
       Msg.info("------------------------------------");
@@ -61,4 +68,4 @@ public class Client extends Process {
       Msg.info("Disk: "+ stos[i].getName());
     }
   }
-}
\ No newline at end of file
+}