Michael Heemskerk avatar Michael Heemskerk committed da985a0

Minor change to reorder methods inside DefaultExternalProcessFactory

Comments (0)

Files changed (1)

src/main/java/com/atlassian/utils/process/DefaultExternalProcessFactory.java

         this.pool = executorService;
     }
 
+    private static ExecutorService createDefaultExecutorService() {
+        final String pooledThreadName = "ExtProcess IO Pump";
+
+        ThreadFactory threadFactory = new ThreadFactory() {
+            public Thread newThread(Runnable r) {
+                return new Thread(r, pooledThreadName);
+            }
+        };
+
+        return new ThreadPoolExecutor(6, Integer.MAX_VALUE, 2, TimeUnit.MINUTES,
+                new SynchronousQueue<Runnable>(), threadFactory) {
+
+            @Override
+            protected void beforeExecute(Thread thread, Runnable runnable) {
+                thread.setName(thread.getId() + ":" + ((LatchedRunnable) runnable).getName());
+                super.beforeExecute(thread, runnable);
+            }
+
+            @Override
+            protected void afterExecute(Runnable runnable, Throwable throwable) {
+                Thread.currentThread().setName(pooledThreadName);
+                super.afterExecute(runnable, throwable);
+            }
+        };
+    }
+
     public ExternalProcess create(ExternalProcessSettings settings) {
         if (shutdown) {
             throw new IllegalStateException("The DefaultExternalProcessFactory has been shutdown; new external processes cannot be created");
             process.setIdleTimeout(settings.getIdleTimeout());
         }
     }
-
-    private static ExecutorService createDefaultExecutorService() {
-        final String pooledThreadName = "ExtProcess IO Pump";
-
-        ThreadFactory threadFactory = new ThreadFactory() {
-            public Thread newThread(Runnable r) {
-                return new Thread(r, pooledThreadName);
-            }
-        };
-
-        return new ThreadPoolExecutor(6, Integer.MAX_VALUE, 2, TimeUnit.MINUTES,
-                new SynchronousQueue<Runnable>(), threadFactory) {
-
-            @Override
-            protected void beforeExecute(Thread thread, Runnable runnable) {
-                thread.setName(thread.getId() + ":" + ((LatchedRunnable) runnable).getName());
-                super.beforeExecute(thread, runnable);
-            }
-
-            @Override
-            protected void afterExecute(Runnable runnable, Throwable throwable) {
-                Thread.currentThread().setName(pooledThreadName);
-                super.afterExecute(runnable, throwable);
-            }
-        };
-    }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.