This commit is contained in:
parent
d6437cef33
commit
2355a6bf8a
@ -47,7 +47,7 @@ public class Nameserver implements INameserver {
|
||||
// Root Nameserver
|
||||
nameServerLocal = new NameServerRemote("root");
|
||||
try {
|
||||
nameserverRemote = (INameserverRemote) UnicastRemoteObject.exportObject(nameServerLocal, registryPort);
|
||||
nameserverRemote = (INameserverRemote) UnicastRemoteObject.exportObject(nameServerLocal, 0);
|
||||
registry = LocateRegistry.createRegistry(registryPort);
|
||||
registry.rebind(registryName, nameserverRemote);
|
||||
System.out.println("Nameserver bound.");
|
||||
@ -62,6 +62,7 @@ public class Nameserver implements INameserver {
|
||||
try {
|
||||
registry = LocateRegistry.getRegistry(registryHost, registryPort);
|
||||
nameserverRemote = (INameserverRemote) registry.lookup(registryName);
|
||||
UnicastRemoteObject.exportObject(nameServerLocal, 0);
|
||||
nameserverRemote.registerNameserver(domain, nameServerLocal);
|
||||
} catch (RemoteException | NotBoundException e) {
|
||||
e.printStackTrace();
|
||||
@ -107,20 +108,20 @@ public class Nameserver implements INameserver {
|
||||
public void shutdown() {
|
||||
// shell is already interrupted
|
||||
// so just close other things
|
||||
try {
|
||||
UnicastRemoteObject.unexportObject(nameServerLocal, true);
|
||||
} catch (NoSuchObjectException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (this.componentId.equals("ns-root")) {
|
||||
try {
|
||||
registry.unbind(registryName);
|
||||
UnicastRemoteObject.unexportObject(nameServerLocal, true);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NotBoundException e) {
|
||||
this.registry.unbind(registryName);
|
||||
UnicastRemoteObject.unexportObject(this.registry, true);
|
||||
} catch(RemoteException | NotBoundException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
this.nameservers();
|
||||
System.out.println("Zone Nameserver...");
|
||||
}
|
||||
System.out.println("Nameserver shut down successfully!");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user