Host
Date: 2013-11-17

org.simgrid.msg

## Class Host

- java.lang.Object
- - org.simgrid.msg.Host

-     public class Host
      extends java.lang.Object

  A host object represents a location (any possible place) where a process may run. Thus it is represented as a physical resource with computing capabilities, some mailboxes to enable running process to communicate with remote ones, and some private data that can be only accessed by local process. An instance of this class is always bound with the corresponding native host. All the native hosts are automatically created during the call of the method Msg.createEnvironment(). This method take as parameter a platform file which describes all elements of the platform (host, link, root..). You cannot create a host yourself. The best way to get an host instance is to call the static method Host.getByName(). For example to get the instance of the host. If your platform file description contains an host named "Jacquelin" : \verbatim Host jacquelin; try { jacquelin = Host.getByName("Jacquelin"); } catch(HostNotFoundException e) { System.err.println(e.toString()); } ... \endverbatim

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Host()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Host[]` | `all()` This static method returns all of the hosts of the installed platform.
    `static Host` | `currentHost()` This static method return an instance to the host of the current process.
    `static Host` | `getByName(java.lang.String name)` This static method gets an host instance associated with a native host of your platform.
    `double` | `getCoreNumber()` This method returns the number of core of a host.
    `static int` | `getCount()` This static method returns the count of the installed hosts.
    `java.lang.Object` | `getData()` Gets the data of the host.
    `int` | `getLoad()` This method returns the number of tasks currently running on a host.
    `java.lang.String` | `getName()` This method returns the name of a host.
    `java.lang.String` | `getProperty(java.lang.String name)` Returns the value of a given host property.
    `double` | `getSpeed()` This method returns the speed of the processor of a host, regardless of the current load of the machine.
    `boolean` | `hasData()` Checks whether a host has data.
    `boolean` | `isAvail()` This method tests if a host is available.
    `static void` | `nativeInit()` Class initializer, to initialize various JNI stuff
    `static void` | `setAsyncMailbox(java.lang.String mailboxName)` This static method sets a mailbox to receive in asynchronous mode.
    `void` | `setData(java.lang.Object data)` Sets the data of the host.
    `void` | `setProperty(java.lang.String name, java.lang.String value)` Change the value of a given host property.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Host

          protected Host()

  - ### Method Detail

    - #### getByName

          public static Host getByName(java.lang.String name)
                                throws HostNotFoundException,
                                       java.lang.NullPointerException

      This static method gets an host instance associated with a native host of your platform. This is the best way to get a java host object.
      Parameters:
        `name` - The name of the host to get.
      Returns:
        The host object with the given name.
      Throws:
        `HostNotFoundException` - if the name of the host is not valid. NativeException if the native version of this method failed.
        `java.lang.NullPointerException`

    - #### getCount

          public static int getCount()

      This static method returns the count of the installed hosts.
      Returns:
        The count of the installed hosts.

    - #### currentHost

          public static Host currentHost()

      This static method return an instance to the host of the current process.
      Returns:
        The host on which the current process is executed.

    - #### all

          public static Host[] all()

      This static method returns all of the hosts of the installed platform.
      Returns:
        An array containing all the hosts installed.

    - #### setAsyncMailbox

          public static void setAsyncMailbox(java.lang.String mailboxName)

      This static method sets a mailbox to receive in asynchronous mode. All messages sent to this mailbox will be transferred to the receiver without waiting for the receive call. The receive call will still be necessary to use the received data. If there is a need to receive some messages asynchronously, and some not, two different mailboxes should be used.
      Parameters:
        `mailboxName` - The name of the mailbox

    - #### getName

          public java.lang.String getName()

      This method returns the name of a host.
      Returns:
        The name of the host.

    - #### setData

          public void setData(java.lang.Object data)

      Sets the data of the host.
      Parameters:
        `data` -

    - #### getData

          public java.lang.Object getData()

      Gets the data of the host.
      Returns:
        The data object associated with the host.

    - #### hasData

          public boolean hasData()

      Checks whether a host has data.
      Returns:
        True if the host has an associated data object.

    - #### getLoad

          public int getLoad()

      This method returns the number of tasks currently running on a host. The external load is not taken in account.
      Returns:
        The number of tasks currently running on a host.

    - #### getSpeed

          public double getSpeed()

      This method returns the speed of the processor of a host, regardless of the current load of the machine.
      Returns:
        The speed of the processor of the host in flops.

    - #### getCoreNumber

          public double getCoreNumber()

      This method returns the number of core of a host.
      Returns:
        The speed of the processor of the host in flops.

    - #### getProperty

          public java.lang.String getProperty(java.lang.String name)

      Returns the value of a given host property.

    - #### setProperty

          public void setProperty(java.lang.String name,
                         java.lang.String value)

      Change the value of a given host property.

    - #### isAvail

          public boolean isAvail()

      This method tests if a host is available.
      Returns:
        True if the host is available.

    - #### nativeInit

          public static void nativeInit()

      Class initializer, to initialize various JNI stuff