added port specification to run_server.sh and PresenceServiceImple.java

git-svn-id: svn://anubis/gvsu@157 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-09-18 01:26:16 +00:00
parent 9065130b2c
commit 916590d206
2 changed files with 10 additions and 3 deletions

View File

@ -38,6 +38,12 @@ public class PresenceServiceImpl implements PresenceService
public static void main(String[] args)
{
int port = 1099;
if (args.length >= 1)
{
port = Integer.parseInt(args[0]);
}
if (System.getSecurityManager() == null)
{
System.setSecurityManager(new SecurityManager());
@ -47,7 +53,7 @@ public class PresenceServiceImpl implements PresenceService
PresenceServiceImpl impl = new PresenceServiceImpl();
PresenceService stub = (PresenceService)
UnicastRemoteObject.exportObject(impl, 0);
Registry registry = LocateRegistry.getRegistry();
Registry registry = LocateRegistry.getRegistry(port);
registry.rebind("PresenceService", stub);
System.out.println("PresenceService bound");
}

View File

@ -1,6 +1,7 @@
rmiregistry &
port = $1
rmiregistry $port &
java \
-cp /home/holtropj/cs656/lab2/src \
-Djava.security.policy=server.policy \
PresenceServiceImpl
PresenceServiceImpl $port
pkill rmiregistry