Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] srgs) {
- try {
- RMINameServer obj = new RMINameServer();
- UnicastRemoteObject.unexportObject(obj, true);
- System.out.println("Exporting...");
- RMINameService stub = (RMINameService) UnicastRemoteObject.exportObject(obj, 0);
- Registry registry;
- if (true) {
- // stworzenie nowego rejestru na localhoscie
- registry = LocateRegistry.createRegistry(1099);
- System.out.println("New registry created on localhost.");
- } else {
- System.out.println("Locating registry...");
- // podlaczenie do istniejaceo rejestru na localhoscie
- registry = LocateRegistry.getRegistry("localhost");
- System.out.println("Registry located");
- }
- registry.rebind("MyNameServer", stub);
- System.out.println("RMINameService bound:, ready");
- obj.counter();
- } catch (Exception e) {
- System.err.println("RMINameService exception: ");
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement