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:
parent
9065130b2c
commit
916590d206
@ -38,6 +38,12 @@ public class PresenceServiceImpl implements PresenceService
|
|||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
|
int port = 1099;
|
||||||
|
if (args.length >= 1)
|
||||||
|
{
|
||||||
|
port = Integer.parseInt(args[0]);
|
||||||
|
}
|
||||||
|
|
||||||
if (System.getSecurityManager() == null)
|
if (System.getSecurityManager() == null)
|
||||||
{
|
{
|
||||||
System.setSecurityManager(new SecurityManager());
|
System.setSecurityManager(new SecurityManager());
|
||||||
@ -47,7 +53,7 @@ public class PresenceServiceImpl implements PresenceService
|
|||||||
PresenceServiceImpl impl = new PresenceServiceImpl();
|
PresenceServiceImpl impl = new PresenceServiceImpl();
|
||||||
PresenceService stub = (PresenceService)
|
PresenceService stub = (PresenceService)
|
||||||
UnicastRemoteObject.exportObject(impl, 0);
|
UnicastRemoteObject.exportObject(impl, 0);
|
||||||
Registry registry = LocateRegistry.getRegistry();
|
Registry registry = LocateRegistry.getRegistry(port);
|
||||||
registry.rebind("PresenceService", stub);
|
registry.rebind("PresenceService", stub);
|
||||||
System.out.println("PresenceService bound");
|
System.out.println("PresenceService bound");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
rmiregistry &
|
port = $1
|
||||||
|
rmiregistry $port &
|
||||||
java \
|
java \
|
||||||
-cp /home/holtropj/cs656/lab2/src \
|
-cp /home/holtropj/cs656/lab2/src \
|
||||||
-Djava.security.policy=server.policy \
|
-Djava.security.policy=server.policy \
|
||||||
PresenceServiceImpl
|
PresenceServiceImpl $port
|
||||||
pkill rmiregistry
|
pkill rmiregistry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user