edu.ucsb.cs.jicos.services
Class Client2Hsp

java.lang.Object
  extended by edu.ucsb.cs.jicos.services.Client2Hsp

public final class Client2Hsp
extends java.lang.Object


Method Summary
 java.lang.Object compute(Task task)
          Application gives a task to the Hsp.
 Result getResult()
          Get the Result object for some computation that was initiated via the setComputation method.
 HspState getState()
          Returns information associated with the state of the Hsp.
 boolean isComplete(ResultId resultId)
           
 void loadState(edu.ucsb.cs.jicos.services.StateConfig stateConfig)
          This method is used to initiate the restoring of state from a datasource described by StateConfig.
 void login(Environment environment)
          login Client with the Hsp.
 Invoice logout()
          logout Client from the Hsp.
 void saveState(edu.ucsb.cs.jicos.services.StateConfig stateConfig)
          This method is used to initiate saving the state of the current computation (i.e HSP and TaskServer state) to the specified datasource described by StateConfig.
 ResultId setComputation(Task task)
          This method is used to initiate a computation without waiting for the computation to complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

compute

public java.lang.Object compute(Task task)
                         throws ComputeException,
                                JicosException,
                                java.rmi.RemoteException
Application gives a task to the Hsp.

Parameters:
task - is the root task of some Task graph.
Returns:
The Object that is the returned value from this computation: The returned value of the sink Task: the Task with no successor.
Throws:
java.rmi.RemoteException - This method is invoked remotely.
ComputeException - This Exception is thrown when a task's execute method throws an Exception. ComputeException propagates the Exception back to this original compute method.
JicosException

getState

public HspState getState()
                  throws java.rmi.RemoteException
Returns information associated with the state of the Hsp.

Returns:
An HspState object.
Throws:
java.rmi.RemoteException - This method is invoked remotely on the Hsp.

getResult

public Result getResult()
                 throws ComputeException,
                        JicosException,
                        java.rmi.RemoteException
Get the Result object for some computation that was initiated via the setComputation method.

Returns:
A Result object.
Throws:
ComputeException - The returned Result object is associated with a computation that was initiated via the setComputation method. If this computation spawned a Task object whose execute method threw a ComputeException, then this invocation of getResult propagates that ComputeException back to the client application.
java.rmi.RemoteException - This is a Remote method.
JicosException

isComplete

public boolean isComplete(ResultId resultId)
                   throws java.lang.IllegalStateException,
                          java.rmi.RemoteException
Throws:
java.lang.IllegalStateException
java.rmi.RemoteException

login

public void login(Environment environment)
           throws java.rmi.RemoteException
login Client with the Hsp.

Parameters:
environment - Data container for client information associated with this client during this login (session).
Throws:
java.rmi.RemoteException - This method is invoked remotely.

logout

public Invoice logout()
               throws java.rmi.RemoteException
logout Client from the Hsp.

Returns:
Invoice, an object indicating how much system resources were consumed by this application.
Throws:
java.rmi.RemoteException - This method is invoked remotely.
java.lang.InterruptedException - The Hsp propagates the logout to the TaskServer network. It waits for Session statistics to be returned from the TaskServer network. Hsp propagates the InterruptedException that wait can throw.

setComputation

public ResultId setComputation(Task task)
                        throws java.rmi.RemoteException
This method is used to initiate a computation without waiting for the computation to complete. To obtain the computed result, the application must invoke the getResult method.

Parameters:
task - The Task object that represents the overall computation.
Returns:
a ResultId. This is useful, if setComputation is invoked several times before getResult is invoked. Since the Results can come back in any order, ResultId is used to associate the returned Result value with the particular setComputation whose ResultId that matches the Result's ResultId. Please see Result for its accessor methods.
Throws:
java.rmi.RemoteException - This is a Remote method.

loadState

public void loadState(edu.ucsb.cs.jicos.services.StateConfig stateConfig)
               throws ComputeException,
                      JicosException,
                      java.rmi.RemoteException
This method is used to initiate the restoring of state from a datasource described by StateConfig. This restore operation should be used in conjunction with the saveState() method and restores the HSP and TaskServer state to that corresponding to the described saveState(). The restore operation clears the current set of tasks, so any running computation will in effect be aborted. This method may be used by an administrator bringing a system down for maintenance. In the current JICOS system, the loadState command must be resubmitted by the client. This should and will likely change in the future when putResult() is moved to the client, at which point a save/load operation could be completed without disruption of the client.

Parameters:
stateConfig - The StateConfig object that describes the datasource.
Throws:
java.rmi.RemoteException - This is a Remote method.
JicosException
ComputeException

saveState

public void saveState(edu.ucsb.cs.jicos.services.StateConfig stateConfig)
               throws ComputeException,
                      JicosException,
                      java.rmi.RemoteException
This method is used to initiate saving the state of the current computation (i.e HSP and TaskServer state) to the specified datasource described by StateConfig. This save operation should be used in conjunction with the loadState() method and saves the HSP and TaskServer state by saving all unassigned and currently in-process tasks. This method may be used by an administrator save the state of a system for maintenance. This method causes all TaskServers to pause before serializing their tasks. This causes some delay -- smaller delays for computations with lots of quick computations, longer delays for computations with few, long computations. Eventually, this could serve as a component of a backup system by periodically saving system state.

Parameters:
stateConfig - The StateConfig object that describes the datasource.
Throws:
java.rmi.RemoteException - This is a Remote method.
JicosException
ComputeException


Jicos: http://cs.ucsb.edu/projects/jicos