com.sun.grid.jgrid
Class ComputeEngineImpl

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended bycom.sun.grid.jgrid.ComputeEngineImpl
All Implemented Interfaces:
ComputeEngine, java.rmi.Remote, java.io.Serializable

public class ComputeEngineImpl
extends java.rmi.server.UnicastRemoteObject
implements ComputeEngine

This class is a dummy implementation of the ComputeEngine interface used to generate stub and skeleton classes. The functionality of this class is actually performed by the ComputeProxy class.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ComputeEngineImpl()
          Constructs ComputeEngineImpl object and exports it on default port.
ComputeEngineImpl(int port)
          Constructs ComputeEngineImpl object and exports it on specified port.
 
Method Summary
 java.io.Serializable compute(Computable job)
          This method submits a job for synchrnous execution.
 java.lang.String computeAsynch(Computable job)
          This method submits a job for asynchrnous execution.
 java.io.Serializable getResults(java.lang.String jobId)
          This method retrieves the results of a job that was executed asynchronously.
 boolean isComplete(java.lang.String jobId)
          This method check whether an asynchronous job has finished executing.
static void main(java.lang.String[] args)
          Main method.
static void registerToRegistry(java.lang.String name, java.rmi.Remote obj, boolean create)
          Register ComputeEngineImpl object with the RMI registry.
 
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

ComputeEngineImpl

public ComputeEngineImpl()
                  throws java.rmi.RemoteException
Constructs ComputeEngineImpl object and exports it on default port.


ComputeEngineImpl

public ComputeEngineImpl(int port)
                  throws java.rmi.RemoteException
Constructs ComputeEngineImpl object and exports it on specified port.

Parameters:
port - The port for exporting
Method Detail

registerToRegistry

public static void registerToRegistry(java.lang.String name,
                                      java.rmi.Remote obj,
                                      boolean create)
                               throws java.rmi.RemoteException,
                                      java.net.MalformedURLException
Register ComputeEngineImpl object with the RMI registry.

Parameters:
obj - the object to bind
name - - name identifying the service in the RMI registry
create - - create local registry if necessary
Throws:
java.rmi.RemoteException - if cannot be exported or bound to RMI registry
java.net.MalformedURLException - if name cannot be used to construct a valid URL
java.lang.IllegalArgumentException - if null passed as name

main

public static void main(java.lang.String[] args)
Main method.

Parameters:
args -

compute

public java.io.Serializable compute(Computable job)
                             throws java.rmi.RemoteException,
                                    ComputeException
This method submits a job for synchrnous execution.

Specified by:
compute in interface ComputeEngine
Parameters:
job - the job to be executed
Returns:
the result object
Throws:
java.rmi.RemoteException - if an error occurs on the server side
ComputeException - if an error occurs during job execution

computeAsynch

public java.lang.String computeAsynch(Computable job)
                               throws java.rmi.RemoteException,
                                      ComputeException
This method submits a job for asynchrnous execution.

Specified by:
computeAsynch in interface ComputeEngine
Parameters:
job - the job to be executed
Returns:
the result object
Throws:
java.rmi.RemoteException - if an error occurs on the server side
ComputeException - if an error occurs during job execution

getResults

public java.io.Serializable getResults(java.lang.String jobId)
                                throws java.rmi.RemoteException,
                                       ComputeException
This method retrieves the results of a job that was executed asynchronously.

Specified by:
getResults in interface ComputeEngine
Parameters:
jobId - the id of the job
Returns:
the results object
Throws:
java.rmi.RemoteException - if an error occurs on the server side
ComputeException - if an error occurs during job execution

isComplete

public boolean isComplete(java.lang.String jobId)
                   throws java.rmi.RemoteException,
                          ComputeException
This method check whether an asynchronous job has finished executing.

Specified by:
isComplete in interface ComputeEngine
Parameters:
jobId - the id of the job
Returns:
whether the job has finished
Throws:
java.rmi.RemoteException - if an error occurs on the server side
ComputeException - if an error occurs during job execution