added skeleton ChatClient class
git-svn-id: svn://anubis/gvsu@140 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
4642c73779
commit
b500ee6c5d
29
cs656/lab2/src/ChatClient.java
Normal file
29
cs656/lab2/src/ChatClient.java
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
import java.rmi.registry.Registry;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ChatClient
|
||||
{
|
||||
public static void main(String args[])
|
||||
{
|
||||
if (System.getSecurityManager() == null)
|
||||
{
|
||||
System.setSecurityManager(new SecurityManager());
|
||||
}
|
||||
try
|
||||
{
|
||||
Registry registry = LocateRegistry.getRegistry(args[0]);
|
||||
PresenceService pserv = (PresenceService)
|
||||
registry.lookup("PresenceService");
|
||||
Pi task = new Pi(Integer.parseInt(args[1]));
|
||||
BigDecimal pi = comp.executeTask(task);
|
||||
System.out.println(pi);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("ChatClient exception:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -46,8 +46,8 @@ public class PresenceServiceImpl implements PresenceService
|
||||
PresenceService stub = (PresenceService)
|
||||
UnicastRemoteObject.exportObject(impl, 0);
|
||||
Registry registry = LocateRegistry.getRegistry();
|
||||
registry.rebind("PresenceServiceImpl", stub);
|
||||
System.out.println("PresenceServiceImpl bound");
|
||||
registry.rebind("PresenceService", stub);
|
||||
System.out.println("PresenceService bound");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user