MCPcopy Index your code
hub / github.com/ccxt/ccxt / cleanupWsClient

Method cleanupWsClient

java/lib/src/main/java/io/github/ccxt/Exchange.java:1777–1793  ·  view source on GitHub ↗
(Client client, Object error)

Source from the content-addressed store, hash-verified

1775 }
1776
1777 @SuppressWarnings("unchecked")
1778 private void cleanupWsClient(Client client, Object error) {
1779 var clientsMap = (java.util.concurrent.ConcurrentHashMap<String, Client>) this.clients;
1780 var urlClient = clientsMap.get(client.url);
1781 if (urlClient != null) {
1782 urlClient.subscriptionsMap().clear();
1783 urlClient.reject(wrapAsNetworkError(error));
1784 clientsMap.remove(client.url);
1785 // NOTE: do NOT call urlClient.close() here. Empirical test (full
1786 // Java WS sweep) showed close()'s messageExecutor.shutdown() races
1787 // with in-flight handleMessage tasks the per-exchange tests still
1788 // need, causing 15 new exchanges to time out vs the baseline.
1789 // The leak the close() was meant to fix is slow-drip (virtual
1790 // threads ~1KB each); we'll address it via a different mechanism
1791 // (e.g. shutdown-on-Exchange.close() only, or a delayed shutdown).
1792 }
1793 }
1794
1795 /**
1796 * Wrap raw Netty / I/O exceptions in a CCXT NetworkError so the test harness's

Callers 2

onCloseMethod · 0.95
onErrorMethod · 0.95

Calls 6

wrapAsNetworkErrorMethod · 0.95
subscriptionsMapMethod · 0.80
rejectMethod · 0.65
getMethod · 0.45
clearMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected