Beispiel #1
0
  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");
    }
  }
Beispiel #2
0
 private static void init() {
   connection = ClientConnection.getInstance();
   findActiveInterval = connection.getWaitTime();
   noInternetInterval = connection.getNoInternetInterval();
   syncInterval = connection.getRefreshInterval();
 }