(Thread thread)
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public Object getExecutor(Thread thread) |
| 52 | throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { |
| 53 | |
| 54 | Object result = super.getExecutor(thread); |
| 55 | |
| 56 | if (result == null) { |
| 57 | Object holder = null; |
| 58 | Object task = null; |
| 59 | try { |
| 60 | Field holderField = thread.getClass().getDeclaredField("holder"); |
| 61 | holderField.setAccessible(true); |
| 62 | holder = holderField.get(thread); |
| 63 | |
| 64 | Field taskField = holder.getClass().getDeclaredField("task"); |
| 65 | taskField.setAccessible(true); |
| 66 | task = taskField.get(holder); |
| 67 | } catch (NoSuchFieldException nfe) { |
| 68 | return null; |
| 69 | } |
| 70 | |
| 71 | if (task != null && task.getClass().getCanonicalName() != null && (task.getClass().getCanonicalName() |
| 72 | .equals("org.apache.tomcat.util.threads.ThreadPoolExecutor.Worker") || |
| 73 | task.getClass().getCanonicalName().equals("java.util.concurrent.ThreadPoolExecutor.Worker"))) { |
| 74 | Field executorField = task.getClass().getDeclaredField("this$0"); |
| 75 | executorField.setAccessible(true); |
| 76 | result = executorField.get(task); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | return result; |
| 81 | } |
| 82 | } |
nothing calls this directly
no test coverage detected