Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1.     public static boolean isFileExistsWithWait(String filePath, int timeout) {
  2.         int counter = 0;
  3.         File file = new File(filePath);
  4.  
  5.         while (!file.exists() || counter < timeout * 1000) {
  6.             TimeMeasure.delay(POLLING_TIMEOUT, TimeUnit.MILLISECONDS);
  7.             counter = + POLLING_TIMEOUT;
  8.         }
  9.  
  10.         return file.exists();
  11.     }
  12.  
  13.         // передават ьс миллисекундах
  14.     public static boolean isFileExistsWithWait(String filePath, int timeout) {
  15.         int counter = 0;
  16.         File file = new File(filePath);
  17.  
  18.         while (!file.exists() || counter < timeout) {
  19.             TimeMeasure.delay(POLLING_TIMEOUT, TimeUnit.MILLISECONDS);
  20.             counter = + POLLING_TIMEOUT;
  21.         }
  22.  
  23.         return file.exists();
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement