If a thread is dying due to an uncaught exception, the answer is simple: catch the exception at an appropriate place so that you can keep going. Either catch the exception within your searchfile method, or make the run method call searchfile in a loop.
More Related Contents:
- How to use wait and notify in Java without IllegalMonitorStateException?
- Handling exceptions from Java ExecutorService tasks
- Who is calling the Java Thread interrupt() method if I’m not?
- Handling Exceptions for ThreadPoolExecutor
- CopyOnWriteArrayList throwing CurrentModificationException
- try/catch with InputMismatchException creates infinite loop
- Synchronization vs Lock
- UnsupportedOperationException when trying to remove from the list returned by Array.asList
- java.sql.SQLException: Access denied for user ‘root’@’localhost’ (using password: YES)
- How to read and understand the java stack trace? [duplicate]
- Prime numbers by Eratosthenes quicker sequential than concurrently?
- Java Synchronized Block for .class
- Synchronization of non-final field
- How can I write custom Exceptions?
- Executors.newCachedThreadPool() versus Executors.newFixedThreadPool()
- Most efficient way to log messages to JavaFX TextArea via threads with simple custom logging frameworks
- How to check if current thread is not main thread
- Handling Java crypto exceptions
- CompletableFuture is not getting executed. If I use the ExecutorService pool it works as expected but not with the common ForkJoinPool
- When does Java’s Thread.sleep throw InterruptedException?
- JDBC driver throws “ResultSet Closed” exception on empty ResultSet
- How to parse number string containing commas into an integer in java?
- Parallel execution of directed acyclic graph of tasks
- What is difference between Errors and Exceptions? [duplicate]
- How can I detect when an Exception’s been thrown globally in Java?
- Why single thread is faster than multithreading in Java?
- Run Java Threads sequentially
- How Threadpool re-use Threads and how it works
- Catching an exception that is nested into another exception
- calling thread.start() within its own constructor [duplicate]