uk.ac.gla.dcs.JPie.MultiprocessorJPie
Class MultiprocessorJPieSRV

java.lang.Object
  extended byuk.ac.gla.dcs.JPie.MultiprocessorJPie.MultiprocessorJPieSRV

public class MultiprocessorJPieSRV
extends java.lang.Object

When started it takes care of communication between client's .spawn(...) method and itself. When communication is esteblished it starts a new VM in which the requested job (JPieTask) is executed. This is a deamom that must run on each machine which wishes to share its CPU.


Constructor Summary
MultiprocessorJPieSRV()
          Default values will be set up
MultiprocessorJPieSRV(java.lang.String[] args)
          The arguments, that are passed on command line are: [0] - port of this deamon [1] - port of new VM (will be extended to port range) [2] - working directory [3] - classpaths for new VM
 
Method Summary
 java.lang.String getIP()
           
 java.lang.String getJPieDir()
           
 java.io.File getJPieDirF()
           
 java.lang.String getNewVMcp()
           
 java.lang.String getNewVMip()
           
 double getNewVMmaxTime()
           
 int getNewVMport()
           
 java.lang.String getNewVMram()
           
static java.lang.String[] getNextARGS4NewInstance(java.lang.String[] args)
          this static method returns an array of arguments to be fed into the constructor of this class.
static int getNOfPorts()
          this static method returns number of ports supplied as arguments into static method getNextARGS4NewInstance(String [] args).
 int getPort()
           
 int getRlength()
           
 java.lang.String getUnique()
           
 boolean isFree4newJob()
           
 boolean isNewVMAlive()
           
 void killNewVM()
           
static void main(java.lang.String[] args)
           
 void negotiateJob(java.net.Socket sock4stream)
          this method must be coherent with JPie.spawm(...), i.e.
 void setUnique(java.lang.String s)
           
 void startNewVM()
           
 void startSession(java.net.Socket socket)
           
 void waitForNewVM()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiprocessorJPieSRV

public MultiprocessorJPieSRV()
Default values will be set up


MultiprocessorJPieSRV

public MultiprocessorJPieSRV(java.lang.String[] args)
The arguments, that are passed on command line are: [0] - port of this deamon [1] - port of new VM (will be extended to port range) [2] - working directory [3] - classpaths for new VM

Method Detail

getNextARGS4NewInstance

public static java.lang.String[] getNextARGS4NewInstance(java.lang.String[] args)
this static method returns an array of arguments to be fed into the constructor of this class. Depending on the arguments passed into this method it creates one or more entries for newVM (in case there are more than one CPU on the host that runs MultiprocessorSRV.main(...)).
When all the entries been called (i.e. the number of MultiprocessorSRV instances equals the number of ports supplied) this method returns null. in order to use any of the ports from the range one must use one of the created instances of MultiprocessorSRV in order to run another job (see doc for the methods of this class).

The arguments supplied are usually passed from command line when running main(...) and must conform to the following format:
[0] - the port number of the server that manages and starts newVMs.
[1] - the port number of ObjectServerThread of the newVM. (each newVM has a port open for Initiator to connect and pass the job, as well as other newVMs which are started from this one to pass all the taps and funnels. this port number is also called JPie port number)
the following formats are acceptable for [1]:
5050 = there is only one job can be spawned on this host at a time with this port.
-5050 = same as above.
5050- = same as above.
5050-5055 = there may be up to 6 jobs running each having port number from the range supplied.


getNOfPorts

public static int getNOfPorts()
this static method returns number of ports supplied as arguments into static method getNextARGS4NewInstance(String [] args). This number will show how many CPUs are available for newVMs, or how many newVMs owner is willing to run simoultaneously for the remote jobs. The number of ports is calculated from the range of ports supplied into getNextARGS4NewInstance(String [] args). See doc on this method for more information about arguments.


getIP

public java.lang.String getIP()

getPort

public int getPort()

getNewVMport

public int getNewVMport()

getNewVMip

public java.lang.String getNewVMip()

getJPieDir

public java.lang.String getJPieDir()

getJPieDirF

public java.io.File getJPieDirF()

getNewVMmaxTime

public double getNewVMmaxTime()

getNewVMram

public java.lang.String getNewVMram()

getNewVMcp

public java.lang.String getNewVMcp()

getRlength

public int getRlength()

setUnique

public void setUnique(java.lang.String s)

getUnique

public java.lang.String getUnique()

killNewVM

public void killNewVM()

waitForNewVM

public void waitForNewVM()
                  throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

isFree4newJob

public boolean isFree4newJob()

isNewVMAlive

public boolean isNewVMAlive()

startNewVM

public void startNewVM()

negotiateJob

public void negotiateJob(java.net.Socket sock4stream)
this method must be coherent with JPie.spawm(...), i.e. if the protocol of negotiation between initiator and servant changes both methods have to be changed accordingly.


main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

startSession

public void startSession(java.net.Socket socket)
                  throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException