system
Class ComputerImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by system.ComputerImpl
All Implemented Interfaces:
Computer, java.io.Serializable, java.rmi.Remote

public class ComputerImpl
extends java.rmi.server.UnicastRemoteObject
implements Computer

Computer that runs Tasks. It registers itself to a Space and the Space will call Computer's run method.

Author:
Sean Ford, Nick Childers
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ComputerImpl()
           
 
Method Summary
 java.lang.Long getComputerId()
           
 java.net.InetSocketAddress getRouter()
           
static void main(java.lang.String[] args)
           
 void registerSelf(java.lang.String hostName)
          Register the Computer to the Space represented by hostName.
 java.lang.Object run(Task task)
          Run a task.
 
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

ComputerImpl

public ComputerImpl()
             throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

registerSelf

public void registerSelf(java.lang.String hostName)
                  throws java.lang.Exception
Register the Computer to the Space represented by hostName.

Parameters:
hostName - Space to connect to
Throws:
java.lang.Exception

run

public java.lang.Object run(Task task)
                     throws java.rmi.RemoteException
Run a task. Return result. This is called by the Remote Space.

Specified by:
run in interface Computer
Parameters:
task - The task to run
Returns:
Object result from Task
Throws:
java.rmi.RemoteException

getComputerId

public java.lang.Long getComputerId()
                             throws java.rmi.RemoteException
Specified by:
getComputerId in interface Computer
Throws:
java.rmi.RemoteException

getRouter

public java.net.InetSocketAddress getRouter()
                                     throws java.rmi.RemoteException
Specified by:
getRouter in interface Computer
Throws:
java.rmi.RemoteException