appl.parallel.server
Class XuluServer

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by appl.parallel.server.XuluServer
All Implemented Interfaces:
ComputingResource, SPMDResource, Serializable, Remote

public class XuluServer
extends UnicastRemoteObject
implements SPMDResource

The Server manages the remote execution of program code. It may be started using the main(String[]) method.
The Server reads the following properties from XuluConfig - the values given should be the defaults.

Property Default Desc
XuluServer.useCodeDownloading false if true, the server tries to download task class files from a HTTP-server at the client-url
XuluServer.registryPort 1099 The port at which a new registry is created, if no running registry was found
XuluServer.multicastgroup 239.1.1.1 The default multicast group
XuluServer.multicastport 10000 The default multicast port
XuluServer.eventDelay 50 Events generated on server side may be delayed to collect multiple Events and send them at once (this saves communication time).Time is given in milliseconds
XuluServer.log4j.logLevel info the level can be 'debug','info','warn','error' or 'fatal' and can be overridden by commandline - Parameters

XuluServer.log4j.mode console the mode can be 'file','chainsaw' or 'console'. File means that the configurationfile xuluserverlog4j.cfg is read.
'chainsaw' means that the server tries to configure the logger each time a new client for a chainsaw instance running at the client ip (standardports)
XuluServer.benchmarkclass appl.util.benchmark.SimpleBenchmark The Benchmark to get a rating for this machine. Notice that you can override the rating with the -rating parameter
XuluServer.useThreads max The number of threads to be used by the server for tasks that support multi-threading. Per default one thread is created for every available Processors (value='max'). More threads than processors may be useful for testing tasks which support multihreading or for processors which support hyperthreading.
XuluServer.runbench true the benchmark is run automatically

Multicasting:
If multicasting does not work, try to disable your firewall or configure it to allow multicast UDP packages. Notice also, that multicasting may not work in virtual machines like VMWare or MS Virtual PC 2004/7.

Assumptions Only one client is connected to the server (and can run Tasks)

See main(String[]) for details about command line parameters

Author:
Dominik Appl
See Also:
ServerMulticastReceiver, Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
XuluServer()
          Creates a new instance at the standard port
XuluServer(boolean configLogging, boolean isInternalServer, int port)
           
XuluServer(boolean configLogging, ClientDataServer clientDataServer)
          
This is used when a Server is running inside the Xulu-Client.
XuluServer(int port)
           
 
Method Summary
 boolean connect()
          Only a connected client has access to all functionality.
 PartitionDataServer createDataServer(String[] IPs)
           
 void disconnect()
          disconnects from the resource
 int getRating()
           
 int getRegistryPort()
           
 ComputingResourceProperties getResourceInformation()
          Should return Information about the ComputingResource.
 boolean isAvailable()
           
 boolean isClientConnected()
           
static void main(String[] args)
          Starts the server.
 Object ping(Object... o)
          Can be used to ping the object
 Object[] runSPMDModelTask(String spmdTaskName, int referenceID, Object... parameters)
          Every time runSPMDModelTask(String, int, Object[]) is called the newest class is loaded from the client.
 void stopServer()
          This method frees all resources.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XuluServer

public XuluServer()
           throws RemoteException
Creates a new instance at the standard port

Throws:
RemoteException

XuluServer

public XuluServer(boolean configLogging,
                  boolean isInternalServer,
                  int port)
           throws RemoteException
Parameters:
configLogging - enable or disable logging
isInternalServer - set to true if you want to make method calls purely local. This is for performance reasons (see RemoteServer.getClientHost()
port - port the server is bound to (0 for default)
Throws:
RemoteException

XuluServer

public XuluServer(boolean configLogging,
                  ClientDataServer clientDataServer)
           throws RemoteException

This is used when a Server is running inside the Xulu-Client. It has performance advantages (direct access - no TCP/IP)

Parameters:
configLogging - enable or disable logging
clientDataServer - a local client for faster access
Throws:
RemoteException

XuluServer

public XuluServer(int port)
           throws RemoteException
Parameters:
port - the port to which the Server is bound
Throws:
RemoteException
Method Detail

main

public static void main(String[] args)
Starts the server.

Parameters:
args - The following parameters are valid:

-loglevel:LEVEL - where LEVEL is 'debug','info' (DEFAULT),'warn','error' or 'fatal'

-logconfig:CONFIG - where CONFIG is 'file','chainsaw' or 'console'
  • 'chainsaw' means that the server tries to configure the logger each time a new client for a chainsaw instance running at the client ip (standardports)

  • 'file' means that the file 'xuluserverlog4j.cfg' in the home-directory is used for configuration
  • 'console' means of course, that the console is used for output

  • -port:PORTNUMBER - binds the server to the specified port (default 1099)

    connect

    public boolean connect()
                    throws RemoteException
    Only a connected client has access to all functionality. When connecting or reconnecting, all data of the server and the corresponding PartitionDataServer is reset!

    Specified by:
    connect in interface ComputingResource
    Returns:
    true for success
    Throws:
    RemoteException
    See Also:
    ComputingResource.connect()

    createDataServer

    public PartitionDataServer createDataServer(String[] IPs)
                                         throws RemoteException
    Specified by:
    createDataServer in interface SPMDResource
    Parameters:
    IPs - the IP addresses of all other participating servers. They MUST have the same index as their according partition in the SplitMap has.
    Returns:
    creates a new PartitionDataServer on this resource and returns it
    Throws:
    RemoteException

    disconnect

    public void disconnect()
                    throws RemoteException
    Description copied from interface: ComputingResource
    disconnects from the resource

    Specified by:
    disconnect in interface ComputingResource
    Throws:
    RemoteException

    getRating

    public int getRating()
    Returns:
    a rating for the machine as discovered by the benchmark

    getRegistryPort

    public int getRegistryPort()
    Returns:
    the registry port the server is bound to

    getResourceInformation

    public ComputingResourceProperties getResourceInformation()
                                                       throws RemoteException
    Description copied from interface: ComputingResource
    Should return Information about the ComputingResource. This Information is primary used to display infos to the user.

    Specified by:
    getResourceInformation in interface ComputingResource
    Throws:
    RemoteException

    isAvailable

    public boolean isAvailable()
                        throws RemoteException
    Specified by:
    isAvailable in interface ComputingResource
    Returns:
    whether this server is available or in use by another client
    Throws:
    RemoteException
    See Also:
    ComputingResource.isAvailable()

    isClientConnected

    public boolean isClientConnected()
    Returns:
    if a client is connected

    ping

    public Object ping(Object... o)
                throws RemoteException
    Description copied from interface: ComputingResource
    Can be used to ping the object

    Specified by:
    ping in interface ComputingResource
    Parameters:
    o - the object to ping with
    Returns:
    the same object
    Throws:
    RemoteException

    runSPMDModelTask

    public Object[] runSPMDModelTask(String spmdTaskName,
                                     int referenceID,
                                     Object... parameters)
                              throws RemoteException
    Every time runSPMDModelTask(String, int, Object[]) is called the newest class is loaded from the client. For performance reasons this will happen only one time per connection.

    Specified by:
    runSPMDModelTask in interface SPMDResource
    Parameters:
    spmdTaskName - name of the taskclass to be executed
    referenceID - the ID of the Grid which should be the reference resource
    parameters - parameters for the given Task
    Returns:
    an object array containing the results for possibly multiple executions (when using multithreading with multi-core cpus)
    Throws:
    RemoteException - if the connection fails
    See Also:
    SPMDResource.runSPMDModelTask(String, int, Object[])

    stopServer

    public void stopServer()
    This method frees all resources.
    Notice that this method is not remotely accessible!