Browse Source

Remove unused code in EsThreadPoolExecutor (#81802)

This commit removes some dead code in EsThreadPoolExecutor.
Tanguy Leroux 3 years ago
parent
commit
491167ea23

+ 1 - 27
server/src/main/java/org/elasticsearch/common/util/concurrent/EsThreadPoolExecutor.java

@@ -22,18 +22,12 @@ import java.util.stream.Stream;
 public class EsThreadPoolExecutor extends ThreadPoolExecutor {
 
     private final ThreadContext contextHolder;
-    private volatile ShutdownListener listener;
 
-    private final Object monitor = new Object();
     /**
      * Name used in error reporting.
      */
     private final String name;
 
-    final String getName() {
-        return name;
-    }
-
     EsThreadPoolExecutor(
         String name,
         int corePoolSize,
@@ -64,24 +58,6 @@ public class EsThreadPoolExecutor extends ThreadPoolExecutor {
         this.contextHolder = contextHolder;
     }
 
-    @Override
-    protected synchronized void terminated() {
-        super.terminated();
-        synchronized (monitor) {
-            if (listener != null) {
-                try {
-                    listener.onTerminated();
-                } finally {
-                    listener = null;
-                }
-            }
-        }
-    }
-
-    public interface ShutdownListener {
-        void onTerminated();
-    }
-
     @Override
     public void execute(Runnable command) {
         command = wrapRunnable(command);
@@ -153,9 +129,7 @@ public class EsThreadPoolExecutor extends ThreadPoolExecutor {
      *
      * @param sb the {@link StringBuilder} to append to
      */
-    protected void appendThreadPoolExecutorDetails(final StringBuilder sb) {
-
-    }
+    protected void appendThreadPoolExecutorDetails(final StringBuilder sb) {}
 
     protected Runnable wrapRunnable(Runnable command) {
         return contextHolder.preserveContext(command);