(long timeout, TimeUnit unit)
| 111 | |
| 112 | |
| 113 | @Override |
| 114 | public Runnable poll(long timeout, TimeUnit unit) throws InterruptedException { |
| 115 | Runnable runnable = super.poll(timeout, unit); |
| 116 | if (runnable == null && parent != null) { |
| 117 | // the poll timed out, it gives an opportunity to stop the current |
| 118 | // thread if needed to avoid memory leaks. |
| 119 | parent.stopCurrentThreadIfNeeded(); |
| 120 | } |
| 121 | return runnable; |
| 122 | } |
| 123 | |
| 124 | @Override |
| 125 | public Runnable take() throws InterruptedException { |