/** * 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); }
extraResult.set("onUpdateResult", ((NSmartContract) item).onUpdated(me)); lowPrioExecutorService.schedule(() -> callbackService.synchronizeFollowerCallbacks(me.getId()), 1, TimeUnit.SECONDS);
newExtraResult.set("onUpdateResult", ((NSmartContract) newItem).onUpdated(me)); lowPrioExecutorService.schedule(() -> callbackService.synchronizeFollowerCallbacks(me.getId()), 1, TimeUnit.SECONDS);