Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do not embeed our version of semaphores
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 2 May 2012 19:24:33 +0000 (21:24 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 2 May 2012 19:24:33 +0000 (21:24 +0200)
Java 1.5 can be considered as sufficiently prevalent for us to not
dupplicate its features. Closes #14217.

CMakeLists.txt
ChangeLog
org/simgrid/msg/Process.java
org/simgrid/msg/Sem.java [deleted file]

index 88dccf4..4408124 100644 (file)
@@ -101,7 +101,6 @@ set(JMSG_JAVA_SRC
        org/simgrid/msg/Process.java
        org/simgrid/msg/ProcessKilled.java
        org/simgrid/msg/ProcessNotFoundException.java
-       org/simgrid/msg/Sem.java
        org/simgrid/msg/Task.java
        org/simgrid/msg/TaskCancelledException.java
        org/simgrid/msg/TimeoutException.java
index ef7fd9f..823c6fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
 SimGrid-java (3.6.1) unstable; urgency=low
+
+ * Do not embeed our version of semaphores, java 1.5 can be considered
+   as sufficiently prevalent for us to not dupplicate its features.
  * Make Process.kill(process) an instance method, not a static one
  * Fix a bug around Process.kill()
  * Add dsend and simulatedSleep to the bindings.
index 10591d3..d5e10d6 100644 (file)
@@ -14,6 +14,7 @@ package org.simgrid.msg;
 import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.Vector;
+import java.util.concurrent.Semaphore;
 
 /**
  * A process may be defined as a code, with some private data, executing 
@@ -105,7 +106,7 @@ public abstract class Process extends Thread {
     /**
      *
      */
-    protected Sem schedBegin, schedEnd;
+    protected Semaphore schedBegin, schedEnd;
     private boolean nativeStop = false;
 
        /**
@@ -118,8 +119,8 @@ public abstract class Process extends Thread {
                this.bind = 0;
                this.args = new Vector<String>();
                this.properties = null;
-               schedBegin = new Sem(0);
-               schedEnd = new Sem(0);
+               schedBegin = new Semaphore(0);
+               schedEnd = new Semaphore(0);
        }
 
 
diff --git a/org/simgrid/msg/Sem.java b/org/simgrid/msg/Sem.java
deleted file mode 100644 (file)
index e034d1a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*\r
- * Simple semaphore implementation, from Doug Lea (public domain)\r
- *\r
- * Copyright 2006,2007,2010,2011 The SimGrid Team           \r
- * All right reserved. \r
- *\r
- * This program is free software; you can redistribute \r
- * it and/or modify it under the terms of the license \r
- *(GNU LGPL) which comes with this package. \r
- */  \r
-\r
-package org.simgrid.msg;\r
-\r
-public class Sem {\r
-       /******************************************************************/ \r
-       /* Simple semaphore implementation, from Doug Lea (public domain) */ \r
-       /******************************************************************/ \r
-       private int permits_;\r
-\r
-    /**\r
-     *\r
-     * @param i\r
-     */\r
-    public Sem(int i) {\r
-               permits_ = i;\r
-       } \r
-\r
-    /**\r
-     *\r
-     * @throws java.lang.InterruptedException\r
-     */\r
-    public void acquire() throws InterruptedException {\r
-               if (Thread.interrupted())\r
-                       throw new InterruptedException();\r
-\r
-               synchronized(this) {\r
-                       try {\r
-                               while (permits_ <= 0)\r
-                                       wait();\r
-                               --permits_;\r
-                       }\r
-                       catch(InterruptedException ex) {\r
-                               notify();\r
-                               throw ex;\r
-                       }\r
-               }\r
-       }\r
-\r
-    /**\r
-     *\r
-     */\r
-    public synchronized void release() {\r
-               ++(this.permits_);\r
-               notify();\r
-       } \r
-} \r