Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[java] unpack dll/so to a tempDir instead of messing with their name
[simgrid.git] / src / bindings / java / org / simgrid / msg / Msg.java
index ec212a7..b324db8 100644 (file)
@@ -9,31 +9,12 @@
 package org.simgrid.msg;
 import org.simgrid.NativeLib;
 
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.File;
-
 
 public final class Msg {
-       /* Statically load the library which contains all native functions used in here */
-       static private boolean isNativeInited = false;
-        public static void nativeInit() {
-                if (isNativeInited)
-                      return;
-                NativeLib.nativeInit("simgrid");
-                NativeLib.nativeInit("simgrid-java");      
-               isNativeInited = true;
-
-       }
 
-       static {
-                nativeInit();
-       }
-        
-    /** Retrieve the simulation time
-     * @return The simulation time.
-     */
+       /** Retrieve the simulation time
+        * @return The simulation time.
+        */
        public final static native double getClock();
        /**
         * Issue a debug logging message.
@@ -47,8 +28,8 @@ public final class Msg {
        public final static native void verb(String s);
 
        /** Issue an information logging message
-     * @param s
-     */
+        * @param s
+        */
        public final static native void info(String s);
        /**
         * Issue an warning logging message.
@@ -86,7 +67,7 @@ public final class Msg {
         * 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(){}
@@ -104,15 +85,15 @@ public final class Msg {
        /**
         * The method to deploy the simulation.
         *
-     *
-     * @param deploymentFile
-     */
+        *
+        * @param deploymentFile
+        */
        public final static native void deployApplication(String deploymentFile);
 
-    /** Example launcher. You can use it or provide your own launcher, as you wish
-     * @param args
-     * @throws MsgException
-     */
+       /** Example launcher. You can use it or provide your own launcher, as you wish
+        * @param args
+        * @throws MsgException
+        */
        static public void main(String[]args) throws MsgException {
                /* initialize the MSG simulation. Must be done before anything else (even logging). */
                Msg.init(args);
@@ -128,4 +109,9 @@ public final class Msg {
                /* Execute the simulation */
                Msg.run();
        }
+       
+       /* Class initializer, to initialize various JNI stuff */
+       static {
+               org.simgrid.NativeLib.nativeInit();
+       }
 }