47
47
import com .hedera .node .app .workflows .dispatcher .TransactionDispatcher ;
48
48
import com .hedera .node .config .ConfigProvider ;
49
49
import com .hedera .node .config .VersionedConfiguration ;
50
- import com .hedera .node .config .data .PreHandleWorkflowConfig ;
51
50
import com .swirlds .platform .system .events .Event ;
52
51
import com .swirlds .platform .system .transaction .Transaction ;
53
52
import edu .umd .cs .findbugs .annotations .NonNull ;
54
53
import edu .umd .cs .findbugs .annotations .Nullable ;
55
54
import java .util .LinkedHashSet ;
56
55
import java .util .Map ;
57
56
import java .util .Set ;
58
- import java .util .concurrent .ForkJoinPool ;
59
57
import java .util .stream .Stream ;
60
58
import javax .inject .Inject ;
61
59
import javax .inject .Singleton ;
@@ -97,10 +95,6 @@ public class PreHandleWorkflowImpl implements PreHandleWorkflow {
97
95
* Used for registering notice of transactionIDs seen by this node
98
96
*/
99
97
private final DeduplicationCache deduplicationCache ;
100
- /**
101
- * Used to pre-handle transactions in parallel.
102
- */
103
- private final ForkJoinPool preHandlePool ;
104
98
105
99
/**
106
100
* Creates a new instance of {@code PreHandleWorkflowImpl}.
@@ -109,6 +103,7 @@ public class PreHandleWorkflowImpl implements PreHandleWorkflow {
109
103
* transaction.
110
104
* @param transactionChecker the {@link TransactionChecker} for parsing and verifying the transaction
111
105
* @param signatureVerifier the {@link SignatureVerifier} to verify signatures
106
+ * @throws NullPointerException if any of the parameters is {@code null}
112
107
*/
113
108
@ Inject
114
109
public PreHandleWorkflowImpl (
@@ -124,12 +119,6 @@ public PreHandleWorkflowImpl(
124
119
this .signatureExpander = requireNonNull (signatureExpander );
125
120
this .configProvider = requireNonNull (configProvider );
126
121
this .deduplicationCache = requireNonNull (deduplicationCache );
127
- final var config = configProvider .getConfiguration ().getConfigData (PreHandleWorkflowConfig .class );
128
- if (config .isCustomPoolEnabled ()) {
129
- preHandlePool = new ForkJoinPool (config .preHandleThreadCount ());
130
- } else {
131
- preHandlePool = ForkJoinPool .commonPool ();
132
- }
133
122
}
134
123
135
124
/**
@@ -149,7 +138,7 @@ public void preHandle(
149
138
final var accountStore = readableStoreFactory .getStore (ReadableAccountStore .class );
150
139
151
140
// In parallel, we will pre-handle each transaction.
152
- transactions .forEach ( tx -> preHandlePool . execute (() -> {
141
+ transactions .parallel (). forEach ( tx -> {
153
142
if (tx .isSystem ()) return ;
154
143
try {
155
144
tx .setMetadata (preHandleTransaction (creator , readableStoreFactory , accountStore , tx ));
@@ -161,7 +150,7 @@ public void preHandle(
161
150
"Possibly CATASTROPHIC failure while running the pre-handle workflow" , unexpectedException );
162
151
tx .setMetadata (unknownFailure ());
163
152
}
164
- })) ;
153
+ });
165
154
}
166
155
167
156
// For each transaction, we will use a background thread to parse the transaction, validate it, lookup the
0 commit comments