private synchronized void setMaster(Server master, boolean updateWOJServerState) {
LOGGER.info("new master in "+_localServer+": old="+_master+" new="+master);
boolean wasMaster = isMaster();
_master = master;
UnifiedAuthentificationService.getInstance().setAuthentificationServer(master);
Key key = _keyProvider.getCurrentKey();
if (key == null || (master != null && !master.equals(key.getServer()))) {
LOGGER.debug("previous private key wasn't from new master: getting new");
_keyProvider.setCurrentKey(null); // ensure that we discard our own key even if we have trouble contacting master
newPrivateKey(!isMaster());
}
if (wasMaster != isMaster()) {