public class SynchronizationThrottler extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Long> |
synchronizationIds |
| Constructor and Description |
|---|
SynchronizationThrottler(MetaApiWebsocketClient client,
int maxConcurrentSynchronizations)
Constructs the synchronization throttler
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isSynchronizationAvailable()
Returns flag whether there are free slots for synchronization requests
|
void |
onDisconnect()
Clears synchronization ids on disconnect
|
void |
removeSynchronizationId(String synchronizationId)
Removes synchronization id from slots and removes ids for the same account from the queue
|
CompletableFuture<com.fasterxml.jackson.databind.JsonNode> |
scheduleSynchronize(String accountId,
com.fasterxml.jackson.databind.node.ObjectNode request)
Schedules to send a synchronization request for account
|
void |
updateSynchronizationId(String synchronizationId)
Fills a synchronization slot with synchronization id
|
public SynchronizationThrottler(MetaApiWebsocketClient client, int maxConcurrentSynchronizations)
client - MetaApi websocket clientmaxConcurrentSynchronizations - Limit of concurrent synchronizationspublic void updateSynchronizationId(String synchronizationId)
synchronizationId - Synchronization idpublic boolean isSynchronizationAvailable()
public void removeSynchronizationId(String synchronizationId)
synchronizationId - Synchronization idpublic void onDisconnect()
public CompletableFuture<com.fasterxml.jackson.databind.JsonNode> scheduleSynchronize(String accountId, com.fasterxml.jackson.databind.node.ObjectNode request)
accountId - Account idrequest - Request to sendCopyright © 2021. All rights reserved.