You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`Future<JSONObject> XMLUtils.toJSONObject(Reader reader, Consumer<JSONObject> after, Consumer<Exception> error)`|**Non-blocking** conversion. Parses the XML read from `reader` into a `JSONObject` on a background thread. When parsing finishes it invokes `after.accept(result)`; when failure it calls `error.accept(ex)` and throws the exception into the returned `Future`. |
8
+
|`AsyncRunner`| Tiny task aggregator. Call `add(Future<JSONObject> task)` to collect jobs, then wait for them all (e.g. `forEach(Future::get)`). |
9
+
|`ExecutorService`| The default thread pool (size = available CPU cores). If you prefer a custom pool you can swap it out before calling the API (e.g. add `XMLUtils.setExecutor(...)`). |
10
+
11
+
Input: XML of different sizes (where they will be parsed concurrently)
12
+
13
+
---
14
+
15
+
## Run the test class
16
+
```bash
17
+
mvn -Dtest=org.json.junit.milestone5.tests.JSONObjectAsyncTest test
0 commit comments