Beispiel #1
0
 private <T> T executionHandler(Callable<T> action) {
   int connectionAttempts = MAX_CONNECTION_ATTEMPTS;
   while (connectionAttempts > 0) {
     try {
       checkConnection();
       return action.call();
     } catch (FTPConnectionClosedException e) {
       LOGGER.debug("Exception", e);
       if (reconnect) {
         LOGGER.warn("Server closed connection. Reconnecting.");
         connectionAttempts--;
         connect();
       }
     } catch (Exception e) {
       LOGGER.debug("Exception", e);
       throw new VirtualFileException(e);
     }
   }
   return null;
 }