com.sun.grid.jgrid.proxy
Class ResultChannelImpl

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

public class ResultChannelImpl
extends java.rmi.server.UnicastRemoteObject
implements ResultChannel

This class implements the ResultsChannel interface. When a result is returned, we find the job in the lockbox and notify the Lock. When then put the results in the lockbox to be picked up by the ComputeProxy.

Since:
0.1
See Also:
Serialized Form

Field Summary
private  java.util.Map lockbox
          Usage to store references to running and completed jobs.
private static java.util.logging.Logger log
          A Map containing ComputeProxy.Lock's for each active job.
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
 
Fields inherited from class java.rmi.server.RemoteServer
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface com.sun.grid.jgrid.proxy.ResultChannel
LOOKUP_NAME, PORT
 
Constructor Summary
ResultChannelImpl(java.util.Map lockbox)
          Constructs ResultChannelImpl object and exports it on default port.
 
Method Summary
static void main(java.lang.String[] args)
          This is a convenience method for testing purposes.
 void sendException(java.lang.Exception e, java.lang.String processId)
          This method sends the execption resulting from a job to the ComputeProxy.
 void sendResult(java.io.Serializable result, java.lang.String processId)
          This method sends the results of a job to the ComputeProxy.
 
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
 

Field Detail

log

private static java.util.logging.Logger log
A Map containing ComputeProxy.Lock's for each active job.


lockbox

private java.util.Map lockbox
Usage to store references to running and completed jobs.

Constructor Detail

ResultChannelImpl

public ResultChannelImpl(java.util.Map lockbox)
                  throws java.rmi.RemoteException
Constructs ResultChannelImpl object and exports it on default port.

Parameters:
lockbox - the Map holding the job locks.
Throws:
java.rmi.RemoteException - if an error occurs on the server side
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
This is a convenience method for testing purposes. It starts a instance of the ResultChannel with a fake job id entry, "MyJob"

Parameters:
args - command line arguments -- ignored
Throws:
java.lang.Exception - anything that goes wrong will result in a stack trace

sendException

public void sendException(java.lang.Exception e,
                          java.lang.String processId)
                   throws java.rmi.RemoteException
This method sends the execption resulting from a job to the ComputeProxy.

Specified by:
sendException in interface ResultChannel
Parameters:
e - the exception
processId - the id of the job
Throws:
java.rmi.RemoteException - if an error occurs on the server side

sendResult

public void sendResult(java.io.Serializable result,
                       java.lang.String processId)
                throws java.rmi.RemoteException
This method sends the results of a job to the ComputeProxy.

Specified by:
sendResult in interface ResultChannel
Parameters:
result - the results object
processId - the id of the job
Throws:
java.rmi.RemoteException - if an error occurs on the server