Skip to content

Commit 90a87f3

Browse files
authored
Support conditional Thread.interrupt() on exception in EngineRule (#1489)
1 parent 6ce0d46 commit 90a87f3

File tree

1 file changed

+14
-2
lines changed
  • runtime/engine/src/test/java/io/aklivity/zilla/runtime/engine/test

1 file changed

+14
-2
lines changed

runtime/engine/src/test/java/io/aklivity/zilla/runtime/engine/test/EngineRule.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ public final class EngineRule implements TestRule
8383
private EngineConfiguration configuration;
8484
private String configRoot;
8585
private Predicate<String> exceptions;
86+
private boolean interruptible;
8687
private boolean clean;
8788

8889
public EngineRule()
8990
{
9091
this.builder = Engine.builder();
9192
this.properties = new Properties();
9293
this.exceptions = m -> false;
94+
this.interruptible = true;
9395

9496
configure(ENGINE_DRAIN_ON_CLOSE, true);
9597
configure(ENGINE_SYNTHETIC_ABORT, true);
@@ -156,6 +158,13 @@ public EngineRule exceptions(
156158
return this;
157159
}
158160

161+
public EngineRule interruptible(
162+
boolean interruptible)
163+
{
164+
this.interruptible = interruptible;
165+
return this;
166+
}
167+
159168
public EngineRule clean()
160169
{
161170
this.clean = true;
@@ -323,9 +332,12 @@ public void evaluate() throws Throwable
323332
final List<Throwable> errors = synchronizedList(new ArrayList<>());
324333
final ErrorHandler errorHandler = ex ->
325334
{
326-
ex.printStackTrace();
327335
errors.add(ex);
328-
baseThread.interrupt();
336+
337+
if (interruptible)
338+
{
339+
baseThread.interrupt();
340+
}
329341
};
330342

331343
FileSystem fs = null;

0 commit comments

Comments
 (0)