|
29 | 29 |
|
30 | 30 | /** |
31 | 31 | * A utility class for multi threaded operation that needs to be cancellable via interrupts. Every cancellable operation should be |
32 | | - * executed via {@link #execute(Interruptable)}, which will capture the executing thread and make sure it is interrupted in the case |
| 32 | + * executed via {@link #execute(Interruptible)}, which will capture the executing thread and make sure it is interrupted in the case |
33 | 33 | * of cancellation. |
34 | 34 | * |
35 | 35 | * Cancellation policy: This class does not support external interruption via <code>Thread#interrupt()</code>. Always use #cancel() instead. |
@@ -77,33 +77,33 @@ private synchronized boolean add() { |
77 | 77 | } |
78 | 78 |
|
79 | 79 | /** |
80 | | - * run the Interruptable, capturing the executing thread. Concurrent calls to {@link #cancel(String)} will interrupt this thread |
| 80 | + * run the Interruptible, capturing the executing thread. Concurrent calls to {@link #cancel(String)} will interrupt this thread |
81 | 81 | * causing the call to prematurely return. |
82 | 82 | * |
83 | | - * @param interruptable code to run |
| 83 | + * @param interruptible code to run |
84 | 84 | */ |
85 | | - public void execute(Interruptable interruptable) { |
| 85 | + public void execute(Interruptible interruptible) { |
86 | 86 | try { |
87 | | - executeIO(interruptable); |
| 87 | + executeIO(interruptible); |
88 | 88 | } catch (IOException e) { |
89 | | - assert false : "the passed interruptable can not result in an IOException"; |
| 89 | + assert false : "the passed interruptible can not result in an IOException"; |
90 | 90 | throw new RuntimeException("unexpected IO exception", e); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | /** |
94 | | - * run the Interruptable, capturing the executing thread. Concurrent calls to {@link #cancel(String)} will interrupt this thread |
| 94 | + * run the Interruptible, capturing the executing thread. Concurrent calls to {@link #cancel(String)} will interrupt this thread |
95 | 95 | * causing the call to prematurely return. |
96 | 96 | * |
97 | | - * @param interruptable code to run |
| 97 | + * @param interruptible code to run |
98 | 98 | */ |
99 | | - public void executeIO(IOInterruptable interruptable) throws IOException { |
| 99 | + public void executeIO(IOInterruptible interruptible) throws IOException { |
100 | 100 | boolean wasInterrupted = add(); |
101 | 101 | boolean cancelledByExternalInterrupt = false; |
102 | 102 | RuntimeException runtimeException = null; |
103 | 103 | IOException ioException = null; |
104 | 104 |
|
105 | 105 | try { |
106 | | - interruptable.run(); |
| 106 | + interruptible.run(); |
107 | 107 | } catch (InterruptedException | ThreadInterruptedException e) { |
108 | 108 | // ignore, this interrupt has been triggered by us in #cancel()... |
109 | 109 | assert cancelled : "Interruption via Thread#interrupt() is unsupported. Use CancellableThreads#cancel() instead"; |
@@ -167,11 +167,11 @@ public synchronized void cancel(String reason) { |
167 | 167 | } |
168 | 168 |
|
169 | 169 |
|
170 | | - public interface Interruptable extends IOInterruptable { |
| 170 | + public interface Interruptible extends IOInterruptible { |
171 | 171 | void run() throws InterruptedException; |
172 | 172 | } |
173 | 173 |
|
174 | | - public interface IOInterruptable { |
| 174 | + public interface IOInterruptible { |
175 | 175 | void run() throws IOException, InterruptedException; |
176 | 176 | } |
177 | 177 |
|
|
0 commit comments