/** * Initialize callback service on node and start synchronization thread. * * @param node is Universa node * @param config is node configuration * @param myInfo is node information * @param ledger is DB ledger * @param network is Universa network * @param nodeKey is public key of node * @param executorService is executor service from node to run synchronization */ public CallbackService(Node node, Config config, NodeInfo myInfo, Ledger ledger, Network network, PrivateKey nodeKey, ScheduledExecutorService executorService) { this.node = node; this.config = config; this.myInfo = myInfo; this.ledger = ledger; this.network = network; this.nodeKey = nodeKey; this.executorService = executorService; // start synchronization executorService.scheduleWithFixedDelay(() -> synchronizeFollowerCallbacks(), 60, config.getFollowerCallbackSynchronizationInterval().getSeconds(), TimeUnit.SECONDS); }
assertEquals(config.getFollowerCallbackDelay(), copyConfig.getFollowerCallbackDelay()); assertEquals(config.getFollowerCallbackStateStoreTime(), copyConfig.getFollowerCallbackStateStoreTime()); assertEquals(config.getFollowerCallbackSynchronizationInterval(), copyConfig.getFollowerCallbackSynchronizationInterval()); assertEquals(config.getRatioNodesSendFollowerCallbackToComplete().doubleValue(), copyConfig.getRatioNodesSendFollowerCallbackToComplete().doubleValue(), 0.001);