private static void startSync() { RemoteException rex; Properties serverList = null; if (serverPortal != null) { while (true) { try { System.out.println(serverPortal.hello()); serverList = serverPortal.getServerList(); try { PropertyHandler.save(SERVER_LIST_FILE, serverList); ClientConnection.getInstance().reload(); } catch (Exception ex) { System.out.println("server list save failed"); } sync.setServerPortal(serverPortal); sync.start(); wait(syncInterval); } catch (RemoteException ex) { rex = ex; break; } } System.out.println("Disconnected, trying to reconnect..."); reconnect(rex); startSync(); } else { System.out.println("No ative server"); } }
private static void startClientMode() { System.out.println("***back-up mode***"); try { activeServerIndex = ClientConnection.getServerIndex(remoteServer.getServerName()); System.out.println(remoteServer.hello()); ServerSync(); // loop } catch (RemoteException ex) { electNewActive(); } }