Workers online working
This commit is contained in:
parent
f01a95f310
commit
daf41eb979
|
|
@ -294,13 +294,17 @@ public class InstanceInterface {
|
|||
fundsAvailable = getFundsAvailable(exchange, "USDT", true);
|
||||
|
||||
//Individual worker status needed to calculate this
|
||||
workers = getAllWorkersStats("binance", true);
|
||||
workers = getAllWorkersStats(exchange, true);
|
||||
|
||||
//Funds needed
|
||||
fundsNeeded = 0;
|
||||
|
||||
//Online workers
|
||||
if (workers != null) {
|
||||
onlineWorkers = workers.size();
|
||||
} else {
|
||||
onlineWorkers = 0;
|
||||
}
|
||||
|
||||
//Long workers
|
||||
longWorkers = 0;
|
||||
|
|
|
|||
|
|
@ -436,6 +436,30 @@ public class HomeFragment extends Fragment {
|
|||
return null;
|
||||
}
|
||||
});
|
||||
CompletableFuture<InstanceInterface.ExchangeStatsData> future15 = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return InstanceInterface.getExchangeStatsData("gateio");
|
||||
} catch (IOException e) {
|
||||
System.err.print(e.toString());
|
||||
return null;
|
||||
}
|
||||
});
|
||||
CompletableFuture<InstanceInterface.ExchangeStatsData> future16 = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return InstanceInterface.getExchangeStatsData("kucoin");
|
||||
} catch (IOException e) {
|
||||
System.err.print(e.toString());
|
||||
return null;
|
||||
}
|
||||
});
|
||||
CompletableFuture<InstanceInterface.ExchangeStatsData> future17 = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return InstanceInterface.getExchangeStatsData("okex");
|
||||
} catch (IOException e) {
|
||||
System.err.print(e.toString());
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Wait for all futures to complete
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(
|
||||
|
|
@ -653,11 +677,32 @@ public class HomeFragment extends Fragment {
|
|||
log3Content.setText(logs3);
|
||||
log4Content.setText(logs4);
|
||||
|
||||
// try {
|
||||
// System.err.println(future14.get());
|
||||
// } catch (ExecutionException | InterruptedException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// Exchange stats
|
||||
InstanceInterface.ExchangeStatsData binanceGlobalStats;
|
||||
InstanceInterface.ExchangeStatsData gateioGlobalStats;
|
||||
InstanceInterface.ExchangeStatsData kucoinGlobalStats;
|
||||
InstanceInterface.ExchangeStatsData okexGlobalStats;
|
||||
try {
|
||||
binanceGlobalStats = future14.get();
|
||||
gateioGlobalStats = future15.get();
|
||||
kucoinGlobalStats = future16.get();
|
||||
okexGlobalStats = future17.get();
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (binanceGlobalStats != null) {
|
||||
exchange1WorkersOnline.setText(String.valueOf(binanceGlobalStats.getOnlineWorkers()));
|
||||
}
|
||||
if (gateioGlobalStats != null) {
|
||||
exchange2WorkersOnline.setText(String.valueOf(gateioGlobalStats.getOnlineWorkers()));
|
||||
}
|
||||
if (kucoinGlobalStats != null) {
|
||||
exchange3WorkersOnline.setText(String.valueOf(kucoinGlobalStats.getOnlineWorkers()));
|
||||
}
|
||||
if (okexGlobalStats != null) {
|
||||
exchange4WorkersOnline.setText(String.valueOf(okexGlobalStats.getOnlineWorkers()));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue