|
19 | 19 | import javax.annotation.Nullable; |
20 | 20 | import java.util.ArrayList; |
21 | 21 | import java.util.Arrays; |
22 | | -import java.util.Collections; |
23 | 22 | import java.util.HashMap; |
24 | | -import java.util.HashSet; |
25 | 23 | import java.util.List; |
26 | 24 | import java.util.Map; |
27 | | -import java.util.Set; |
28 | 25 | import java.util.concurrent.ConcurrentHashMap; |
29 | 26 | import java.util.concurrent.Future; |
30 | 27 | import java.util.function.Supplier; |
@@ -80,28 +77,18 @@ public void removeBatchProcessor(IBatchProcessor processor) { |
80 | 77 |
|
81 | 78 | @Override |
82 | 79 | public IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) { |
83 | | - Map<Integer, Set<IBatchProcessor>> ordered = new HashMap<>(); |
| 80 | + Map<Integer, List<IBatchProcessor>> ordered = new HashMap<>(); |
84 | 81 | IChunkSet chunkSet = set; |
85 | 82 | for (IBatchProcessor processor : processors) { |
86 | 83 | if (processor.getScope() != ProcessorScope.ADDING_BLOCKS) { |
87 | | - ordered.merge( |
88 | | - processor.getScope().intValue(), |
89 | | - new HashSet<>(Collections.singleton(processor)), |
90 | | - (existing, theNew) -> { |
91 | | - existing.add(processor); |
92 | | - return existing; |
93 | | - } |
94 | | - ); |
| 84 | + ordered.computeIfAbsent(processor.getScope().intValue(), k -> new ArrayList<>()) |
| 85 | + .add(processor); |
95 | 86 | continue; |
96 | 87 | } |
97 | 88 | chunkSet = processSet(processor, chunk, get, chunkSet); |
98 | 89 | } |
99 | | - if (ordered.size() > 0) { |
100 | | - for (int i = 1; i <= 4; i++) { |
101 | | - Set<IBatchProcessor> processors = ordered.get(i); |
102 | | - if (processors == null) { |
103 | | - continue; |
104 | | - } |
| 90 | + if (!ordered.isEmpty()) { |
| 91 | + for (List<IBatchProcessor> processors : ordered.values()) { |
105 | 92 | for (IBatchProcessor processor : processors) { |
106 | 93 | chunkSet = processSet(processor, chunk, get, chunkSet); |
107 | 94 | if (chunkSet == null) { |
|
0 commit comments