tictactoe
Class GameFactory
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--tictactoe.GameFactory
- public class GameFactory
- extends java.rmi.server.UnicastRemoteObject
- implements RemoteGameFactory
Implements factory method to instantiate BoardGame
for remote clients.
- Version:
- 3.0 1999-04-01
- Author:
- Oscar.Nierstrasz@acm.org
- See Also:
- Serialized Form
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Constructor Summary |
GameFactory()
Must be declared since we inherit from UnicastRemoteObject |
Method Summary |
RemoteGame |
joinGame()
Returns a RemoteGame instance for a remote client. |
static void |
main(java.lang.String[] args)
main() method to create one instance of GameFactory
and register it with the Naming service. |
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 |
GameFactory
public GameFactory()
throws java.rmi.RemoteException
- Must be declared since we inherit from UnicastRemoteObject
main
public static void main(java.lang.String[] args)
- main() method to create one instance of GameFactory
and register it with the Naming service.
- Parameters:
args
- server:port (e.g., asterix.unibe.ch:2001)
joinGame
public RemoteGame joinGame()
throws java.rmi.RemoteException
- Returns a RemoteGame instance for a remote client.
If a game already exists, the client joins the
existing game. Else a new game is made.
This method is synchronized since multiple clients
may try to connect concurrently.
- Specified by:
- joinGame in interface RemoteGameFactory