in case of cleanup failure do not try to clean again
authorEugene Zhuravlev <jeka@intellij.com>
Mon, 30 Jan 2012 16:16:05 +0000 (17:16 +0100)
committerEugene Zhuravlev <jeka@intellij.com>
Mon, 30 Jan 2012 20:54:55 +0000 (21:54 +0100)
jps/jps-builders/src/org/jetbrains/jps/server/ServerState.java

index b82fe1449b280cdab60b7eff7f50566de458ab40..1c8da9b339f86e12bb7c0e5ab00f12e8a24a83aa 100644 (file)
@@ -245,14 +245,20 @@ class ServerState {
     return compileScope;
   }
 
+
+  private static boolean ourCleanupFailed = false;
+
   private static void clearZipIndexCache() {
-    try {
-      final Class<?> indexClass = Class.forName("com.sun.tools.javac.zip.ZipFileIndex");
-      final Method clearMethod = indexClass.getMethod("clearCache");
-      clearMethod.invoke(null);
-    }
-    catch (Throwable ex) {
-      LOG.info(ex);
+    if (!ourCleanupFailed) {
+      try {
+        final Class<?> indexClass = Class.forName("com.sun.tools.javac.zip.ZipFileIndex");
+        final Method clearMethod = indexClass.getMethod("clearCache");
+        clearMethod.invoke(null);
+      }
+      catch (Throwable ex) {
+        ourCleanupFailed = true;
+        LOG.info(ex);
+      }
     }
   }