public void startListening() {
  SwingWorker w = new SwingWorker() {
    protected Object doInBackground() {
      boolean retry = true;
      while (retry) {
        try {
          RESTDatabase.this.listen();
        } catch (JSONException e1) {
          System.err.println("WARNING: " + RESTDatabase.this + " " + e1);
          retry = false;
        } catch (Exception e2) {
          System.err.println("WARNING: " + RESTDatabase.this + " " + e2);
          try {
            Thread.sleep(60000);
          } catch (InterruptedException e3) {
            System.err.println(e3); //Should not go there...
          }
        }
      }
      return null;
    }
  };
  w.execute();
}