X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ed49d3fb7b2cab0c93fb3e1d686e3041598b70d4..681ccbd571ddd586398863c1c53167c9469bc857:/org/simgrid/msg/Host.java?ds=sidebyside diff --git a/org/simgrid/msg/Host.java b/org/simgrid/msg/Host.java index e5548b9e82..905596d26b 100644 --- a/org/simgrid/msg/Host.java +++ b/org/simgrid/msg/Host.java @@ -50,7 +50,10 @@ public class Host { * @see Host.getByName(). */ public long bind; - + /** + * Host name + */ + private String name; /** * User data. @@ -74,34 +77,22 @@ public class Host { * @exception HostNotFoundException if the name of the host is not valid. * NativeException if the native version of this method failed. */ - public static Host getByName(String name) - throws HostNotFoundException { - Process.ifInterruptedStop(); - if (name==null) - throw new NullPointerException("No host can have a null name"); - return MsgNative.hostGetByName(name); - } - + public native static Host getByName(String name) + throws HostNotFoundException, NullPointerException; /** * This static method returns the count of the installed hosts. * * @return The count of the installed hosts. - * + * FIXME: Not implemented. */ - public static int getCount() { - Process.ifInterruptedStop(); - return MsgNative.hostGetCount(); - } + public native static int getCount(); /** * This static method return an instance to the host of the current process. * * @return The host on which the current process is executed. */ - public static Host currentHost() { - Process.ifInterruptedStop(); - return MsgNative.hostSelf(); - } + public native static Host currentHost(); /** * This static method returns all of the hosts of the installed platform. @@ -109,39 +100,29 @@ public class Host { * @return An array containing all the hosts installed. * */ - public static Host[] all() { - Process.ifInterruptedStop(); - return MsgNative.allHosts(); - } + public native static Host[] all(); /** * This method returns the name of a host. - * * @return The name of the host. * */ - public String getName() { - Process.ifInterruptedStop(); - return MsgNative.hostGetName(this); + public String getName() { + return name; } - /** * Sets the data of the host. - * - * * @param data */ public void setData(Object data) { - Process.ifInterruptedStop(); this.data = data; } /** - * Gets the data of the host. + * Gets the d ata of the host. * * @return */ public Object getData() { - Process.ifInterruptedStop(); return this.data; } @@ -151,7 +132,6 @@ public class Host { * @return */ public boolean hasData() { - Process.ifInterruptedStop(); return null != this.data; } @@ -161,10 +141,7 @@ public class Host { * * @return The number of tasks currently running on a host. */ - public int getLoad() { - Process.ifInterruptedStop(); - return MsgNative.hostGetLoad(this); - } + public native int getLoad(); /** * This method returns the speed of the processor of a host, @@ -173,16 +150,18 @@ public class Host { * @return The speed of the processor of the host in flops. * */ - public double getSpeed() { - Process.ifInterruptedStop(); - return MsgNative.hostGetSpeed(this); - } + public native double getSpeed(); /** This method tests if a host is avail. * @return */ - public boolean isAvail() { - Process.ifInterruptedStop(); - return MsgNative.hostIsAvail(this); - } + public native boolean isAvail(); + + /** + * Class initializer, to initialize various JNI stuff + */ + public static native void nativeInit(); + static { + nativeInit(); + } }