Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanups to please sonar
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 23 Aug 2016 00:06:22 +0000 (02:06 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 23 Aug 2016 00:06:22 +0000 (02:06 +0200)
examples/java/app/tokenring/Main.java
examples/java/app/tokenring/RelayRunner.java
examples/java/async/dsend/Receiver.java
examples/java/async/dsend/Sender.java

index d1423aa..2448865 100644 (file)
@@ -26,7 +26,7 @@ class Main {
                
                Host[] hosts = Host.all();
                for (int rank = 0; rank < hosts.length; rank++) {
-                       Process proc = new RelayRunner(hosts[rank], ""+rank,  null);
+                       Process proc = new RelayRunner(hosts[rank], Integer.toString(rank),  null);
                        proc.start();
                }
                Msg.info("Number of hosts '"+hosts.length+"'");
index 0f1bf9c..c045cdb 100644 (file)
@@ -21,6 +21,7 @@ public class RelayRunner extends Process {
        }
 
        /* This is the function executed by this kind of processes */
+       @Override
        public void main(String[] args) throws MsgException {
                // In this example, the processes are given numerical names: "0", "1", "2", and so on 
                int rank = Integer.parseInt(this.getName());
@@ -45,7 +46,7 @@ public class RelayRunner extends Process {
                        
                    Msg.info("Host '"+rank+"' received '"+token.getName()+"'");
 
-                   String mailbox = ""+(rank+1); // Java idiomatic to get the String version of rank+1
+                   String mailbox = Integer.toString(rank+1);
                    if (rank+1 == Host.getCount()) {
                        /* The last process has no right neighbor, so it sends the token back to rank 0 */
                        mailbox = "0";
index 162a15e..7a9aba8 100644 (file)
@@ -18,6 +18,7 @@ public class Receiver extends Process {
     super(host,name);
   }
 
+  @Override
   public void main(String[] args) throws TransferFailureException, HostFailureException, TimeoutException {
     Msg.info("Receiving on '"+ getHost().getName() + "'");
     Task.receive(getHost().getName());
index 329d24c..85e83db 100644 (file)
@@ -17,6 +17,7 @@ public class Sender extends Process {
     super(host,name);
   }
 
+  @Override
   public void main(String[] args) throws MsgException {
     double taskComputeSize =0;
     double taskCommunicateSize = 5000000;