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

Method cleanUnsubscription

java/lib/src/main/java/io/github/ccxt/Exchange.java:14149–14190  ·  view source on GitHub ↗
(Client client, Object subHash, Object unsubHash, Object... optionalArgs)

Source from the content-addressed store, hash-verified

14147 }
14148
14149 public void cleanUnsubscription(Client client, Object subHash, Object unsubHash, Object... optionalArgs)
14150 {
14151 Object subHashIsPrefix = Helpers.getArg(optionalArgs, 0, false);
14152 if (Helpers.isTrue(Helpers.inOp(client.subscriptions, unsubHash)))
14153 {
14154 ((java.util.Map<String,Object>)client.subscriptions).remove((String)unsubHash);
14155 }
14156 if (!Helpers.isTrue(subHashIsPrefix))
14157 {
14158 if (Helpers.isTrue(Helpers.inOp(client.subscriptions, subHash)))
14159 {
14160 ((java.util.Map<String,Object>)client.subscriptions).remove((String)subHash);
14161 }
14162 if (Helpers.isTrue(Helpers.inOp(client.futures, subHash)))
14163 {
14164 var error = new UnsubscribeError(Helpers.add(Helpers.add(this.id, " "), subHash));
14165 client.reject(error, subHash);
14166 }
14167 } else
14168 {
14169 Object clientSubscriptions = Helpers.objectKeys(client.subscriptions);
14170 for (var i = 0; Helpers.isLessThan(i, Helpers.getArrayLength(clientSubscriptions)); i++)
14171 {
14172 Object sub = Helpers.GetValue(clientSubscriptions, i);
14173 if (Helpers.isTrue(((String)sub).startsWith(((String)subHash))))
14174 {
14175 ((java.util.Map<String,Object>)client.subscriptions).remove((String)sub);
14176 }
14177 }
14178 Object clientFutures = Helpers.objectKeys(client.futures);
14179 for (var i = 0; Helpers.isLessThan(i, Helpers.getArrayLength(clientFutures)); i++)
14180 {
14181 Object future = Helpers.GetValue(clientFutures, i);
14182 if (Helpers.isTrue(((String)future).startsWith(((String)subHash))))
14183 {
14184 var error = new UnsubscribeError(Helpers.add(Helpers.add(this.id, " "), future));
14185 client.reject(error, future);
14186 }
14187 }
14188 }
14189 client.resolve(true, unsubHash);
14190 }
14191
14192 public void cleanCache(Object subscription)
14193 {

Calls 11

getArgMethod · 0.95
isTrueMethod · 0.95
inOpMethod · 0.95
addMethod · 0.95
objectKeysMethod · 0.95
isLessThanMethod · 0.95
getArrayLengthMethod · 0.95
GetValueMethod · 0.95
rejectMethod · 0.65
resolveMethod · 0.65
removeMethod · 0.45

Tested by

no test coverage detected