Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
reduce Java debt (endless wip)
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 17 Jun 2016 07:41:22 +0000 (09:41 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 17 Jun 2016 07:41:22 +0000 (09:41 +0200)
23 files changed:
examples/java/app/bittorrent/Main.java
examples/java/app/centralizedmutex/Main.java
examples/java/app/masterworker/Main.java
examples/java/app/pingpong/Receiver.java
examples/java/cloud/migration/Daemon.java
examples/java/cloud/migration/Main.java
examples/java/cloud/migration/Test.java
examples/java/dht/chord/Main.java
examples/java/dht/kademlia/Common.java
examples/java/dht/kademlia/Main.java
examples/java/energy/consumption/Main.java
examples/java/io/file/Main.java
examples/java/io/storage/Main.java
examples/java/process/kill/Main.java
examples/java/process/migration/Main.java
examples/java/process/startkilltime/Main.java
examples/java/process/suspend/Main.java
examples/java/task/priority/Main.java
examples/java/trace/pingpong/Main.java
examples/java/trace/pingpong/Receiver.java
src/bindings/java/org/simgrid/NativeLib.java
src/bindings/java/org/simgrid/msg/Msg.java
src/bindings/java/org/simgrid/msg/Process.java

index 7443a7e..021b1c5 100644 (file)
@@ -9,7 +9,11 @@ package app.bittorrent;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.MsgException;
 
-public class Main{
+class Main{
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws MsgException {
     Msg.init(args);
     if(args.length < 2) {
index 6d8c6d1..32a584d 100644 (file)
@@ -10,6 +10,10 @@ import org.simgrid.msg.Msg;
 import org.simgrid.msg.NativeException;
 
 class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws NativeException {
     Msg.init(args);
 
index cc24eed..c1e905c 100644 (file)
@@ -14,9 +14,9 @@ import org.simgrid.msg.NativeException;
 class Main {
   public static final int TASK_COMP_SIZE = 10000000;
   public static final int TASK_COMM_SIZE = 10000000;
-  /* 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
-   */
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
 
   public static void main(String[] args) throws NativeException {
     /* initialize the MSG simulation. Must be done before anything else (even logging). */
index 80d832e..2617455 100644 (file)
@@ -21,8 +21,6 @@ public class Receiver extends Process {
   public void main(String[] args) throws MsgException {
     Msg.info("hello!");
 
-    double time = Msg.getClock();
-
     Msg.info("try to get a task");
 
     PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
@@ -31,7 +29,7 @@ public class Receiver extends Process {
 
     Msg.info("Got at time "+ timeGot);
     Msg.info("Was sent at time "+timeSent);
-    time = timeSent;
+    double time = timeSent;
 
     double communicationTime = timeGot - time;
     Msg.info("Communication time : " + communicationTime);
index 68a31f3..d03d09a 100644 (file)
@@ -10,29 +10,28 @@ import org.simgrid.msg.*;
 import org.simgrid.msg.Process;
 
 public class Daemon extends Process {
-       private Task currentTask;
-    public Daemon(VM vm, int load) {
-               super((Host)vm,"Daemon");
-       currentTask = new Task(this.getHost().getName()+"-daemon-0", this.getHost().getSpeed()*100, 0);
-    }
-    public void main(String[] args) throws MsgException {
-        int i = 1;
-        while(!Main.isEndOfTest()) {
-            // TODO the binding is not yet available
-            try {
-                currentTask.execute();
-            } catch (HostFailureException e) {
-                e.printStackTrace();
-            } catch (TaskCancelledException e) {
-                System.out.println("task cancelled");
-                suspend(); // Suspend the process
-            }
-            currentTask = new Task(this.getHost().getName()+"-daemon-"+(i++), this.getHost().getSpeed()*100, 0);
-//            Msg.info(currentTask.getName());
-        }
+  private Task currentTask;
+  public Daemon(VM vm, int load) {
+    super((Host)vm,"Daemon");
+    currentTask = new Task(this.getHost().getName()+"-daemon-0", this.getHost().getSpeed()*100, 0);
+  }
+  public void main(String[] args) throws MsgException {
+    int i = 1;
+    while(!Main.isEndOfTest()) {
+      // TODO the binding is not yet available
+    try {
+      currentTask.execute();
+    } catch (HostFailureException e) {
+      e.printStackTrace();
+    } catch (TaskCancelledException e) {
+      System.out.println("task cancelled");
+      suspend(); // Suspend the process
     }
+    currentTask = new Task(this.getHost().getName()+"-daemon-"+(i++), this.getHost().getSpeed()*100, 0);
+  }
+}
 
-    public double getRemaining(){
-        return this.currentTask.getFlopsAmount();
-    }
+  public double getRemaining(){
+    return this.currentTask.getFlopsAmount();
+  }
 }
index af1aa25..2ae9be0 100644 (file)
@@ -14,6 +14,10 @@ import org.simgrid.msg.MsgException;
 public class Main {
   private static boolean endOfTest = false;
 
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void setEndOfTest(){
     endOfTest=true;
   }
index 2e59f4b..279917e 100644 (file)
@@ -18,22 +18,27 @@ public class Test extends Process{
     super(hostname, name);
   }
 
-  public void main(String[] strings) throws MsgException {
-    double startTime = 0;
-    double endTime = 0;
+  public void doMigration(VM vm, Host src, Host dst) throws HostFailureException{
+    Msg.info("     - Launch migration from "+ src.getName() +" to " + dst.getName());
+    double startTime = Msg.getClock();
+    vm.migrate(dst);
+    double endTime = Msg.getClock();
+    Msg.info("     - End of Migration from "+ src.getName() +" to " + dst.getName()+ " (duration:" +
+             (endTime-startTime)+")");
+  }
 
-    /* get hosts 1 and 2*/
+  public void main(String[] strings) throws MsgException {
     Host host0 = null;
     Host host1 = null;
-
     try {
+    /* get hosts 1 and 2*/
       host0 = Host.getByName("PM0");
       host1 = Host.getByName("PM1");
     }catch (HostNotFoundException e) {
-      e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+      e.printStackTrace();
     }
 
-    List<VM> vms = new ArrayList<VM>();
+    List<VM> vms = new ArrayList<>();
 
     /* Create VM1 */
     int dpRate = 70;
@@ -47,8 +52,7 @@ public class Test extends Process{
 
     Msg.info("Load of collocated VMs fluctuate between 0 and 90% in order to create a starvation issue and see "
              + "whether it impacts or not the migration time");
-    XVM vm1 = null;
-    vm1 = new XVM(host0, "vm0",
+    XVM vm1 = new XVM(host0, "vm0",
         1, // Nb of vcpu
         2048, // Ramsize,
         125, // Net Bandwidth
@@ -62,7 +66,7 @@ public class Test extends Process{
 
     /* Collocated VMs */
     int collocatedSrc = 6;
-    int vmSrcLoad[] = {
+    int[] vmSrcLoad = {
         80,
         0,
         90,
@@ -71,7 +75,7 @@ public class Test extends Process{
         90,
     };
 
-    XVM tmp = null;
+    XVM tmp;
     for (int i=1 ; i<= collocatedSrc ; i++){
       tmp = new XVM(host0, "vm"+i,
           1, // Nb of vcpu
@@ -88,7 +92,7 @@ public class Test extends Process{
     }
 
     int collocatedDst = 6;
-    int vmDstLoad[] = {
+    int[] vmDstLoad = {
         0,
         40,
         90,
@@ -114,31 +118,14 @@ public class Test extends Process{
 
     Msg.info("Round trip of VM1 (load "+load1+"%)");
     vm1.setLoad(load1);
-    Msg.info("     - Launch migration from PM0 to PM1");
-    startTime = Msg.getClock();
-    vm1.migrate(host1);
-    endTime = Msg.getClock();
-    Msg.info("     - End of Migration from PM0 to PM1 (duration:"+(endTime-startTime)+")");
-    Msg.info("     - Launch migration from PM1 to PM0");
-    startTime = Msg.getClock();
-    vm1.migrate(host0);
-    endTime = Msg.getClock();
-    Msg.info("     - End of Migration from PM1 to PM0 (duration:"+(endTime-startTime)+")");
-
+    doMigration(vm1, host0, host1);
+    doMigration(vm1, host1, host0);
     Msg.info("");
     Msg.info("");
     Msg.info("Round trip of VM1 (load "+load2+"%)");
     vm1.setLoad(load2);
-    Msg.info("     - Launch migration from PM0 to PM1");
-    startTime = Msg.getClock();
-    vm1.migrate(host1);
-    endTime = Msg.getClock();
-    Msg.info("     - End of Migration from PM0 to PM1 (duration:"+(endTime-startTime)+")");
-    Msg.info("     - Launch migration from PM1 to PM0");
-    startTime = Msg.getClock();
-    vm1.migrate(host0);
-    endTime = Msg.getClock();
-    Msg.info("     - End of Migration from PM1 to PM0 (duration:"+(endTime-startTime)+")");
+    doMigration(vm1, host0, host1);
+    doMigration(vm1, host1, host0);
 
     Main.setEndOfTest();
     Msg.info("Forcefully destroy VMs");
index 44e2425..0128a89 100644 (file)
@@ -8,7 +8,11 @@ package dht.chord;
 
 import org.simgrid.msg.Msg;
 
-public class Main {
+class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) {
     Msg.init(args);
     if(args.length < 2) {
index 9ec3d57..890899f 100644 (file)
@@ -29,4 +29,7 @@ public class Common {
 
   public final static int MAX_STEPS = 10;
   public final static int JOIN_BUCKETS_QUERIES = 1;
+  private Common() {
+    throw new IllegalAccessError("Utility class");
+  }
 }
index ffb9dd4..dacbfae 100644 (file)
@@ -8,7 +8,11 @@ package dht.kademlia;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.MsgException;
 
-public class Main {
+class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws MsgException {
     Msg.init(args);
     if(args.length < 2) {
index 1297b9a..f403e0d 100644 (file)
@@ -14,6 +14,9 @@ public class Main {
   public static final double task_comp_size = 10;
   public static final double task_comm_size = 10;
   public static final int hostNB = 2 ; 
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
 
   public static void main(String[] args) throws MsgException {  
     Msg.energyInit(); 
index 998f911..c1b72dd 100644 (file)
@@ -11,6 +11,10 @@ import org.simgrid.msg.Host;
 import org.simgrid.msg.MsgException;
 
 public class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws MsgException {
     Msg.init(args);
     if(args.length < 1) {
index 9b77b8d..b81a143 100644 (file)
@@ -10,6 +10,10 @@ import org.simgrid.msg.Host;
 import org.simgrid.msg.MsgException;
 
 public class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws MsgException {
     Msg.init(args);
     if(args.length < 1) {
index 8a1065a..f62b469 100644 (file)
@@ -11,6 +11,10 @@ import org.simgrid.msg.MsgException;
 import org.simgrid.msg.NativeException;
 
 public class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws NativeException {
     /* initialize the MSG simulation. Must be done before anything else (even logging). */
     Msg.init(args);
index 66eb2b1..9498dbc 100644 (file)
@@ -15,6 +15,10 @@ class Main {
   protected static Mutex mutex;
   protected static Process processToMigrate = null;
 
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws NativeException {
     Msg.init(args);
     if(args.length < 1) {
index e24ecd1..2168b16 100644 (file)
@@ -9,6 +9,10 @@ import org.simgrid.msg.Msg;
 import org.simgrid.msg.NativeException;
 
 public class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws NativeException {
     Msg.init(args);
     if(args.length < 2) {
index 22af113..04510e8 100644 (file)
@@ -9,6 +9,10 @@ import org.simgrid.msg.Msg;
 import org.simgrid.msg.MsgException;
 
 public class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) {
     Msg.init(args);
     if(args.length < 1) {
index adf7fc2..29133c1 100644 (file)
@@ -10,6 +10,10 @@ import org.simgrid.msg.NativeException;
 
 /* Demonstrates the use of Task.setPriority to change the computation priority of a task */ 
 public class Main {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws NativeException {
     Msg.init(args);
     if(args.length < 2) {
index bd43e17..da7d657 100644 (file)
@@ -11,6 +11,10 @@ import org.simgrid.msg.MsgException;
 import org.simgrid.msg.NativeException;
 
 public class Main  {
+  private Main() {
+    throw new IllegalAccessError("Utility class");
+  }
+
   public static void main(String[] args) throws MsgException, NativeException {
     Msg.init(args);
     if(args.length < 1) {
index 0a57d52..2771655 100644 (file)
@@ -25,9 +25,6 @@ public class Receiver extends Process {
   public void main(String[] args) throws MsgException {
     Msg.info("hello!");
     Trace.hostPushState (getHost().getName(), "PM_STATE", "waitingPing");
-    double communicationTime=0;
-
-    double time = Msg.getClock();
 
     /* Wait for the ping */ 
     Msg.info("try to get a task");
@@ -38,9 +35,9 @@ public class Receiver extends Process {
 
     Msg.info("Got at time "+ timeGot);
     Msg.info("Was sent at time "+timeSent);
-    time=timeSent;
+    double time=timeSent;
 
-    communicationTime=timeGot - time;
+    double communicationTime=timeGot - time;
     Msg.info("Communication time : " + communicationTime);
 
     Msg.info(" --- bw "+ commSizeBw/communicationTime + " ----");
index 35527c0..150b0cc 100644 (file)
@@ -16,7 +16,13 @@ import java.nio.file.Path;
 
 public final class NativeLib {
        /* Statically load the library which contains all native functions used in here */
-       static private boolean isNativeInited = false;
+       private static boolean isNativeInited = false;
+       static Path tempDir = null;
+
+       private NativeLib() {
+               throw new IllegalAccessError("Utility class");
+       }
+
        public static void nativeInit() {
                if (isNativeInited)
                        return;
@@ -25,7 +31,7 @@ public final class NativeLib {
                        NativeLib.nativeInit("winpthread-1");
 
                NativeLib.nativeInit("simgrid");
-               NativeLib.nativeInit("simgrid-java");      
+               NativeLib.nativeInit("simgrid-java");
                isNativeInited = true;
        }
 
@@ -38,7 +44,7 @@ public final class NativeLib {
                        try {
                                System.loadLibrary(name);
                        } catch (UnsatisfiedLinkError systemException) {
-                               if (! name.equals("boost_context")) { // Ignore when we cannot load boost_context
+                               if (! "boost_context".equals(name)) { // Ignore when we cannot load boost_context
                                        
                                        System.err.println("\nCannot load the bindings to the "+name+" library in path "+getPath());
                                        Throwable cause = embeededException.getCause();
@@ -48,7 +54,7 @@ public final class NativeLib {
                                                else if (cause.getMessage().matches(".*libboost_context.so.*"))
                                                        System.err.println("HINT: Try to install the boost-context package (sudo apt-get install libboost-context-dev).");
                                                else
-                                                       System.err.println("Try to install the missing dependencies, which name should appear above.");                                                 
+                                                       System.err.println("Try to install the missing dependencies, which name should appear above.");
                                        } else {
                                                System.err.println("This jar file does not seem to fit your system, and no usable SimGrid installation found on disk.");
                                        }
@@ -68,9 +74,9 @@ public final class NativeLib {
 
                if (arch.matches("^i[3-6]86$"))
                        arch = "x86";
-               else if (arch.equalsIgnoreCase("x86_64"))
+               else if ("x86_64".equalsIgnoreCase(arch))
                        arch = "amd64";
-               else if (arch.equalsIgnoreCase("AMD64"))
+               else if ("AMD64".equalsIgnoreCase(arch))
                        arch = "amd64";
 
                if (os.toLowerCase().startsWith("win")){
@@ -83,31 +89,31 @@ public final class NativeLib {
 
                return prefix + "/" + os + "/" + arch + "/";
        }
-       static Path tempDir = null;
+
        private static void loadLib (String name) throws LinkageException {
-               String Path = NativeLib.getPath();
+               String path = NativeLib.getPath();
 
                String filename=name;
-               InputStream in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename);
+               InputStream in = NativeLib.class.getClassLoader().getResourceAsStream(path+filename);
 
                if (in == null) {
                        filename = "lib"+name+".so";
-                       in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename);
+                       in = NativeLib.class.getClassLoader().getResourceAsStream(path+filename);
                }
                if (in == null) {
                        filename = name+".dll";
-                       in =  NativeLib.class.getClassLoader().getResourceAsStream(Path+filename);
+                       in =  NativeLib.class.getClassLoader().getResourceAsStream(path+filename);
                }
                if (in == null) {
                        filename = "lib"+name+".dll";
-                       in =  NativeLib.class.getClassLoader().getResourceAsStream(Path+filename);
+                       in =  NativeLib.class.getClassLoader().getResourceAsStream(path+filename);
                }
                if (in == null) {
                        filename = "lib"+name+".dylib";
-                       in =  NativeLib.class.getClassLoader().getResourceAsStream(Path+filename);
+                       in =  NativeLib.class.getClassLoader().getResourceAsStream(path+filename);
                }
                if (in == null) {
-                       throw new LinkageException("Cannot find library "+name+" in path "+Path+". Sorry, but this jar does not seem to be usable on your machine.");
+                       throw new LinkageException("Cannot find library "+name+" in path "+path+". Sorry, but this jar does not seem to be usable on your machine.");
                }
                try {
                        // We must write the lib onto the disk before loading it -- stupid operating systems
@@ -121,9 +127,9 @@ public final class NativeLib {
                        /* copy the library in position */  
                        OutputStream out = new FileOutputStream(fileOut);
                        byte[] buffer = new byte[4096]; 
-                       int bytes_read; 
-                       while ((bytes_read = in.read(buffer)) != -1)     // Read until EOF
-                               out.write(buffer, 0, bytes_read); 
+                       int bytesRead; 
+                       while ((bytesRead = in.read(buffer)) != -1)     // Read until EOF
+                               out.write(buffer, 0, bytesRead); 
 
                        /* close all file descriptors, and load that shit */
                        in.close();
@@ -146,13 +152,13 @@ public final class NativeLib {
                                for (File f : dir.listFiles())
                                        if (! f.delete() )
                                                System.err.println("Unable to clean temporary file "+f.getAbsolutePath()+" during shutdown.");
-                           if (! dir.delete() )
+                               if (! dir.delete() )
                                        System.err.println("Unable to clean temporary file "+dir.getAbsolutePath()+" during shutdown.");                                
                        } catch(Exception e) {
                                System.err.println("Unable to clean temporary file "+dir.getAbsolutePath()+" during shutdown: "+e.getCause());
                                e.printStackTrace();
                        }
-               }    
+               }
        }
 
 
index f4cb975..bd49fd2 100644 (file)
@@ -13,19 +13,23 @@ import org.simgrid.NativeLib;
 public final class Msg {
 
        /** Retrieves the simulation time */
-       public final static native double getClock();
+       public static final native double getClock();
        /** Issue a debug logging message. */
-       public final static native void debug(String msg);
+       public static final native void debug(String msg);
        /** Issue a verbose logging message. */
-       public final static native void verb(String msg);
+       public static final native void verb(String msg);
        /** Issue an information logging message */
-       public final static native void info(String msg);
+       public static final native void info(String msg);
        /** Issue a warning logging message. */
-       public final static native void warn(String msg);
+       public static final native void warn(String msg);
        /** Issue an error logging message. */
-       public final static native void error(String msg);
+       public static final native void error(String msg);
        /** Issue a critical logging message. */
-       public final static native void critical(String s);
+       public static final native void critical(String s);
+
+       private Msg() {
+               throw new IllegalAccessError("Utility class");
+       }
 
        /*********************************************************************************
         * Deployment and initialization related functions                               *
@@ -35,10 +39,10 @@ public final class Msg {
         *
         * @param args            The arguments of the command line of the simulation.
         */
-       public final static native void init(String[]args);
+       public static final native void init(String[]args);
        
        /** Tell the kernel that you want to use the energy plugin */
-       public final static native void energyInit();
+       public static final native void energyInit();
 
        /** Run the MSG simulation.
         *
@@ -47,19 +51,15 @@ public final class Msg {
         * retrieve the information that you want from the simulation. In particular, retrieving the status 
         * of a process or the current date is perfectly ok. 
         */
-       public final static native void run() ;
-
-       /** This function is useless nowadays, just stop calling it. */
-       @Deprecated
-       public final static void clean(){}
+       public static final native void run() ;
 
        /** Create the simulation environment by parsing a platform file. */
-       public final static native void createEnvironment(String platformFile);
+       public static final native void createEnvironment(String platformFile);
 
-       public final static native As environmentGetRoutingRoot();
+       public static final native As environmentGetRoutingRoot();
 
        /** Starts your processes by parsing a deployment file. */
-       public final static native void deployApplication(String deploymentFile);
+       public static final native void deployApplication(String deploymentFile);
 
        /** Example launcher. You can use it or provide your own launcher, as you wish
         * @param args
index 291ab60..d9b3b6e 100644 (file)
@@ -7,7 +7,7 @@
 package org.simgrid.msg;
 
 import java.util.Arrays;
-import java.util.Vector;
+import java.util.ArrayList;
 
 /**
  * A process may be defined as a code, with some private data, executing 
@@ -53,7 +53,7 @@ public abstract class Process implements Runnable {
         * 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;
+       private static long nextProcessId = 0;
 
        /**
         * Even if this attribute is public you must never access to it.
@@ -77,7 +77,7 @@ public abstract class Process implements Runnable {
        private Host host = null;
 
        /** The arguments of the method function of the process. */     
-       public Vector<String> args;
+       public ArrayList<String> args;
 
 
        /**  Default constructor */
@@ -85,7 +85,7 @@ public abstract class Process implements Runnable {
                this.id = nextProcessId++;
                this.name = null;
                this.bind = 0;
-               this.args = new Vector<String>();
+               this.args = new ArrayList<>();
        }
 
 
@@ -116,7 +116,7 @@ public abstract class Process implements Runnable {
         * @throws NativeException
         *
         */ 
-       public Process(String hostname, String name, String args[]) throws HostNotFoundException, NativeException {
+       public Process(String hostname, String name, String[] args) throws HostNotFoundException, NativeException {
                this(Host.getByName(hostname), name, args);
        }
        /**
@@ -142,15 +142,15 @@ public abstract class Process implements Runnable {
                this();
                this.host = host;
                if (host == null)
-                       throw new NullPointerException("Process name cannot be NULL");
+                       throw new NullPointerException("Host cannot be NULL");
                if (name == null)
                        throw new NullPointerException("Process name cannot be NULL");
                this.name = name;
 
-               this.args = new Vector<String>();
+               this.args = new ArrayList<>();
                if (null != args)
                        this.args.addAll(Arrays.asList(args));
-       }       
+       }
        /**
         * Constructs a new process from a host and his name, the arguments of here method function are
         * specified by the parameter args.
@@ -171,12 +171,12 @@ public abstract class Process implements Runnable {
                        throw new NullPointerException("Process name cannot be NULL");
                this.name = name;
 
-               this.args = new Vector<String>();
+               this.args = new ArrayList<>();
                if (null != args)
                        this.args.addAll(Arrays.asList(args));
 
                this.startTime = startTime;
-               this.killTime = killTime;               
+               this.killTime = killTime;
        }
        /**
         * The natively implemented method to create an MSG process.
@@ -305,7 +305,7 @@ public abstract class Process implements Runnable {
         * @param millis the length of time to sleep in milliseconds.
         * @param nanos additionnal nanoseconds to sleep.
         */
-       public native static void sleep(long millis, int nanos) throws HostFailureException;
+       public static native void sleep(long millis, int nanos) throws HostFailureException;
        /**
         * Makes the current process sleep until time seconds have elapsed.
         * @param seconds               The time the current process must sleep.
@@ -331,7 +331,7 @@ public abstract class Process implements Runnable {
 
                try {
                        args = new String[this.args.size()];
-                       if (this.args.size() > 0) {
+                       if (!this.args.isEmpty()) {
                                this.args.toArray(args);
                        }