synchronized (clients) { Iterator iter = clients.iterator(); while (iter.hasNext()) { MessageTransportClient client = (MessageTransportClient)iter.next(); if (log.isInfoEnabled()) log.info("run: Unregistering client "+client); registry.unregisterClient(client); try { System.setProperty("java.rmi.server.hostname",myAddr); } catch (Exception e) { log.error("run: ERROR calling System.setProperty(\"java.rmi.server.hostname\","+myAddr+")",e); } if (log.isInfoEnabled()) log.info("run: Registering client "+client); registry.registerClient(client); } }
try { System.setProperty("java.rmi.server.hostname",myAddr); registry.ipAddressChanged(); } catch (Exception e) { log.error("run: ERROR calling System.setProperty(\"java.rmi.server.hostname\","+myAddr+")",e); }
    public void run() {	try {	    InetAddress inetAddr = InetAddress.getLocalHost();	    if (log.isDetailEnabled())		log.detail("run: InetAddress="+inetAddr);	    String addr = inetAddr.getHostAddress();	    String host = inetAddr.getHostName();	    if (log.isDetailEnabled()) {		log.detail("run: addr="+addr);		log.detail("run: host="+host);	    }	    if (myAddr == null && myHost == null) {		myAddr = addr;		myHost = host;		if (log.isInfoEnabled()) {		    log.info("run: myAddr initialized to "+myAddr);		    log.info("run: myHost initialized to "+myHost);		}	    } else if (!addr.equals(myAddr) && host.equals(myHost)) {		if (log.isInfoEnabled())		    log.info("run: "+myHost+"'s address changed from "+myAddr+" to "+addr+".  Re-registering clients.");		if (eventSvc.isEventEnabled())		    eventSvc.event("IP Address of "+myHost+" changed from "+myAddr+" to "+addr);		myAddr = addr;		synchronized (clients) {		    Iterator iter = clients.iterator();		    while (iter.hasNext()) {			MessageTransportClient client = (MessageTransportClient)iter.next();			if (log.isInfoEnabled())			    log.info("run: Unregistering client "+client);			registry.unregisterClient(client);			try {			    System.setProperty("java.rmi.server.hostname",myAddr);			} catch (Exception e) {			    log.error("run: ERROR calling System.setProperty(\"java.rmi.server.hostname\","+myAddr+")",e);			}			if (log.isInfoEnabled())			    log.info("run: Registering client "+client);					registry.registerClient(client);		    }		}						    }	} catch (java.net.UnknownHostException e) {	    log.error("run: getLocalHost returned an unknown host.", e);	}    }