コード例 #1
0
ファイル: client.java プロジェクト: jasonchenliang/DBLike
  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");
    }
  }
コード例 #2
0
ファイル: client.java プロジェクト: jasonchenliang/DBLike
 private static void init() {
   connection = ClientConnection.getInstance();
   findActiveInterval = connection.getWaitTime();
   noInternetInterval = connection.getNoInternetInterval();
   syncInterval = connection.getRefreshInterval();
 }