Start an async method-name call on the virtual executor and return a Future that resolves with the result (or is rejected on failure). Used by WS transpile output to replace TS `this.spawn(this.method, ...args)` when the return value is captured (e.g., stored in a cache). Mirrors how the TS Promise
(String methodName, Object... args)
| 1859 | * how the TS Promise returned by `this.spawn(...)` is consumed. |
| 1860 | */ |
| 1861 | public io.github.ccxt.ws.Future spawnWithResult(String methodName, Object... args) { |
| 1862 | io.github.ccxt.ws.Future fut = new io.github.ccxt.ws.Future(); |
| 1863 | this.spawn(() -> { |
| 1864 | try { |
| 1865 | Object result = Helpers.callDynamically(this, methodName, args); |
| 1866 | // callDynamically may return a CompletableFuture — unwrap |
| 1867 | if (result instanceof java.util.concurrent.CompletableFuture<?> cf) { |
| 1868 | result = cf.join(); |
| 1869 | } |
| 1870 | fut.resolve(result); |
| 1871 | } catch (Exception e) { |
| 1872 | fut.reject(e); |
| 1873 | } |
| 1874 | }); |
| 1875 | return fut; |
| 1876 | } |
| 1877 | |
| 1878 | /** |
| 1879 | * Load order book snapshot from REST and merge with cached deltas. |
no test coverage detected