com.sun.grid.jgrid.proxy
Class ResultChannelImpl
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
com.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 |
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 |
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.
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
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 exceptionprocessId
- 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 objectprocessId
- the id of the job
- Throws:
java.rmi.RemoteException
- if an error occurs on the server