public class SynchronizationThrottler extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SynchronizationThrottler.Options
Options for synchronization throttler
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Long> |
synchronizationIds |
| Constructor and Description |
|---|
SynchronizationThrottler(MetaApiWebsocketClient client,
int socketInstanceIndex,
SynchronizationThrottler.Options opts)
Constructs the synchronization throttler
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getActiveSynchronizationIds()
Returns the list of currenly active synchronization ids
|
int |
getMaxConcurrentSynchronizations()
Returns the amount of maximum allowed concurrent synchronizations
|
List<String> |
getSynchronizingAccounts()
Returns the list of currently synchronizing account ids
|
boolean |
isSynchronizationAvailable()
Returns flag whether there are free slots for synchronization requests
|
void |
onDisconnect()
Clears synchronization ids on disconnect
|
void |
removeIdByParameters(String accountId,
int instanceIndex,
String host)
Removes synchronizations from queue and from the list by parameters
|
void |
removeSynchronizationId(String synchronizationId)
Removes synchronization id from slots and removes ids for the same account from the queue
|
CompletableFuture<Boolean> |
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 socketInstanceIndex, SynchronizationThrottler.Options opts) throws cloud.metaapi.sdk.clients.error_handler.ValidationException
client - MetaApi websocket clientsocketInstanceIndex - index of socket instance that uses the throttleropts - Synchronization throttler optionscloud.metaapi.sdk.clients.error_handler.ValidationException - if specified options are invalidpublic void updateSynchronizationId(String synchronizationId)
synchronizationId - Synchronization idpublic List<String> getSynchronizingAccounts()
public List<String> getActiveSynchronizationIds()
public int getMaxConcurrentSynchronizations()
public boolean isSynchronizationAvailable()
public void removeIdByParameters(String accountId, int instanceIndex, String host)
accountId - account idinstanceIndex - account instance indexhost - account host namepublic void removeSynchronizationId(String synchronizationId)
synchronizationId - Synchronization idpublic void onDisconnect()
public CompletableFuture<Boolean> scheduleSynchronize(String accountId, com.fasterxml.jackson.databind.node.ObjectNode request)
accountId - Account idrequest - Request to sendCopyright © 2022. All rights reserved.