Example #1
0
 public void run() {
   AbstractXMPPConnection abstractXMPPConnection =
       (AbstractXMPPConnection) ReconnectionManager.this.weakRefConnection.get();
   if (abstractXMPPConnection != null) {
     while (ReconnectionManager.this.isReconnectionPossible(abstractXMPPConnection)) {
       int timeDelay = timeDelay();
       while (ReconnectionManager.this.isReconnectionPossible(abstractXMPPConnection)
           && timeDelay > 0) {
         try {
           Thread.sleep(1000);
           int i = timeDelay - 1;
           for (ConnectionListener reconnectingIn : abstractXMPPConnection.connectionListeners) {
             reconnectingIn.reconnectingIn(i);
           }
           timeDelay = i;
         } catch (Throwable e) {
           ReconnectionManager.LOGGER.log(Level.FINE, "waiting for reconnection interrupted", e);
         }
       }
       for (ConnectionListener reconnectingIn2 : abstractXMPPConnection.connectionListeners) {
         reconnectingIn2.reconnectingIn(0);
       }
       try {
         if (ReconnectionManager.this.isReconnectionPossible(abstractXMPPConnection)) {
           abstractXMPPConnection.connect();
         }
       } catch (Exception e2) {
         Exception exception = e2;
         for (ConnectionListener reconnectingIn22 : abstractXMPPConnection.connectionListeners) {
           reconnectingIn22.reconnectionFailed(exception);
         }
       }
     }
   }
 }
Example #2
0
 public final void run() {
   while (ReconnectionManager.this.isReconnectionAllowed()) {
     this.attempts++;
     int remainingSeconds =
         this.attempts > 13
             ? (ReconnectionManager.this.randomBase * 6) * 5
             : this.attempts > 7
                 ? ReconnectionManager.this.randomBase * 6
                 : ReconnectionManager.this.randomBase;
     while (ReconnectionManager.this.isReconnectionAllowed() && remainingSeconds > 0) {
       try {
         Thread.sleep(1000);
         remainingSeconds--;
         ReconnectionManager.this.notifyAttemptToReconnectIn$13462e();
       } catch (InterruptedException e) {
         ReconnectionManager.LOGGER.warning("Sleeping thread interrupted");
         ReconnectionManager.this.notifyReconnectionFailed$698b7e31();
       }
     }
     try {
       if (ReconnectionManager.this.isReconnectionAllowed()) {
         ReconnectionManager.this.connection.connect();
       }
     } catch (Exception e2) {
       ReconnectionManager.this.notifyReconnectionFailed$698b7e31();
     }
   }
 }