Implement all TODOs
This commit is contained in:
@@ -2,22 +2,9 @@ package dev.banking.service;
|
||||
|
||||
import dev.banking.model.*;
|
||||
import dev.banking.processor.TransactionProcessor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
/**
|
||||
* Dispatches a list of transactions to a shared ExecutorService
|
||||
* for concurrent (asynchronous) processing.
|
||||
*
|
||||
* Each transaction is submitted as an independent task and may
|
||||
* be executed in parallel depending on thread availability.
|
||||
*
|
||||
* No ordering guarantees are provided between transactions.
|
||||
*
|
||||
* Lifecycle management of the ExecutorService (creation,
|
||||
* shutdown, termination) is handled outside this class.
|
||||
*/
|
||||
public class BankingSystem {
|
||||
|
||||
private final ExecutorService executor;
|
||||
@@ -34,13 +21,10 @@ public class BankingSystem {
|
||||
public void processTransactions(
|
||||
List<Transaction> transactions
|
||||
) {
|
||||
|
||||
for (Transaction tx : transactions) {
|
||||
|
||||
executor.submit(() -> {
|
||||
processor.process(tx);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user