system
Class Space

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by system.Space
All Implemented Interfaces:
Client2Space, Computer2Space, FFChatSpace, java.io.Serializable, java.rmi.Remote

public class Space
extends java.rmi.server.UnicastRemoteObject
implements Computer2Space, Client2Space, FFChatSpace

Manages the Computer 'cloud' and handles the passing of Task and Result objects between the client and computers.

Author:
Sean Ford
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface api.Computer2Space
SERVICE_NAME
 
Fields inherited from interface api.Client2Space
SERVICE_NAME
 
Fields inherited from interface api.FFChatSpace
SERVICE_NAME
 
Constructor Summary
Space()
          Constructor.
 
Method Summary
 FFServerHandle getFFServer()
          get a fast flux chat server reference
 FFServerHandle getRouter()
           
static void main(java.lang.String[] args)
          Start up Space and register RMI service.
 void put(Task task)
          Called remotely by a client to add a Task.
 java.lang.Long register(Computer computer, java.net.InetSocketAddress address)
          Called remotely by a Computer to register itself.
 void removeProxy(ComputerProxy proxy)
           
 void startRegistry()
          Create the registry and setup the bindings for the Client2Space and Computer2Space services.
 Task takeTask()
          Get a task from the task queue.
 
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

Space

public Space()
      throws java.rmi.RemoteException
Constructor.

Throws:
java.rmi.RemoteException
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Start up Space and register RMI service.

Parameters:
args -
Throws:
java.lang.Exception

takeTask

public Task takeTask()
              throws java.lang.InterruptedException
Get a task from the task queue.

Returns:
Throws:
java.lang.InterruptedException

startRegistry

public void startRegistry()
                   throws java.rmi.RemoteException
Create the registry and setup the bindings for the Client2Space and Computer2Space services.

Throws:
java.rmi.RemoteException

register

public java.lang.Long register(Computer computer,
                               java.net.InetSocketAddress address)
                        throws java.rmi.RemoteException
Called remotely by a Computer to register itself.

Specified by:
register in interface Computer2Space
Throws:
java.rmi.RemoteException

removeProxy

public void removeProxy(ComputerProxy proxy)

put

public void put(Task task)
         throws java.rmi.RemoteException
Called remotely by a client to add a Task. We assume that the client has a single task per problem (which can be freely decomposed into smaller tasks), but still, the client is only actually adding one task. As such, whenever they add a task, we clear the shared object. We only want to preserve the shared object when child tasks are added using putChild().

Specified by:
put in interface Client2Space
Throws:
java.rmi.RemoteException

getFFServer

public FFServerHandle getFFServer()
                           throws java.rmi.RemoteException
Description copied from interface: FFChatSpace
get a fast flux chat server reference

Specified by:
getFFServer in interface FFChatSpace
Throws:
java.rmi.RemoteException

getRouter

public FFServerHandle getRouter()
Specified by:
getRouter in interface Computer2Space