1 | package com.pivovarit.collectors; | |
2 | ||
3 | import java.util.concurrent.Executor; | |
4 | import java.util.concurrent.ThreadPoolExecutor; | |
5 | ||
6 | final class Preconditions { | |
7 | ||
8 | private Preconditions() { | |
9 | } | |
10 | ||
11 | static void requireValidParallelism(int parallelism) { | |
12 |
2
1. requireValidParallelism : negated conditional → TIMED_OUT 2. requireValidParallelism : changed conditional boundary → KILLED |
if (parallelism < 1) { |
13 | throw new IllegalArgumentException("Parallelism can't be lower than 1"); | |
14 | } | |
15 | } | |
16 | ||
17 | static void requireValidExecutor(Executor executor) { | |
18 |
1
1. requireValidExecutor : negated conditional → KILLED |
if (executor instanceof ThreadPoolExecutor tpe) { |
19 | switch (tpe.getRejectedExecutionHandler()) { | |
20 | case ThreadPoolExecutor.DiscardPolicy __ -> | |
21 | throw new IllegalArgumentException("Executor's RejectedExecutionHandler can't discard tasks"); | |
22 | case ThreadPoolExecutor.DiscardOldestPolicy __ -> | |
23 | throw new IllegalArgumentException("Executor's RejectedExecutionHandler can't discard tasks"); | |
24 | default -> { | |
25 | // no-op | |
26 | } | |
27 | } | |
28 | } | |
29 | } | |
30 | } | |
Mutations | ||
12 |
1.1 2.2 |
|
18 |
1.1 |