Browse Source

Cleanup FileSystemUtils#mkdirs(File)

This methods had some workarounds for bugs that seem to be fixed
in Java 7 [1]. There seem to be other problems on shared file-systems
which are not really supported by lucene anyway or rather not
recommeded. Yet the current solution that interrupts a static thread
reference is too dangrous given all the usage of NIO across
elasticsearch.

[1] http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4742723
Simon Willnauer 11 years ago
parent
commit
7c6d745523

+ 1 - 25
src/main/java/org/elasticsearch/common/io/FileSystemUtils.java

@@ -33,32 +33,8 @@ import java.nio.file.StandardOpenOption;
  */
 public class FileSystemUtils {
 
-    private static ESLogger logger = ESLoggerFactory.getLogger(FileSystemUtils.class.getName());
-
-    private static final long mkdirsStallTimeout = TimeValue.timeValueMinutes(5).millis();
-    private static final Object mkdirsMutex = new Object();
-    private static volatile Thread mkdirsThread;
-    private static volatile long mkdirsStartTime;
-
     public static boolean mkdirs(File dir) {
-        synchronized (mkdirsMutex) {
-            try {
-                mkdirsThread = Thread.currentThread();
-                mkdirsStartTime = System.currentTimeMillis();
-                return dir.mkdirs();
-            } finally {
-                mkdirsThread = null;
-            }
-        }
-    }
-
-    public static void checkMkdirsStall(long currentTime) {
-        Thread mkdirsThread1 = mkdirsThread;
-        long stallTime = currentTime - mkdirsStartTime;
-        if (mkdirsThread1 != null && (stallTime > mkdirsStallTimeout)) {
-            logger.error("mkdirs stalled for {} on {}, trying to interrupt", new TimeValue(stallTime), mkdirsThread1.getName());
-            mkdirsThread1.interrupt(); // try and interrupt it...
-        }
+        return dir.mkdirs();
     }
 
     public static boolean hasExtensions(File root, String... extensions) {

+ 0 - 5
src/main/java/org/elasticsearch/threadpool/ThreadPool.java

@@ -518,11 +518,6 @@ public class ThreadPool extends AbstractComponent {
                     running = false;
                     return;
                 }
-                try {
-                    FileSystemUtils.checkMkdirsStall(estimatedTimeInMillis);
-                } catch (Exception e) {
-                    // ignore
-                }
             }
         }
     }