public void startCallbackProcessor(Contract updatingItem, ItemState state, NSmartContract contract, NMutableEnvironment me) {
CallbackProcessor callback = new CallbackProcessor(updatingItem, state, contract, me.getId(), this);
CallbackRecord.addCallbackRecordToLedger(callback.getId(), me.getId(), config, network.getNodesCount(), ledger);
int startDelay = callback.getDelay();
int repeatDelay = (int) config.getFollowerCallbackDelay().toMillis() * (network.getNodesCount() + 2);
callback.setExecutor(executorService.scheduleWithFixedDelay(() -> callback.call(), startDelay, repeatDelay, TimeUnit.MILLISECONDS));
synchronized (callbackProcessors) {
callbackProcessors.put(callback.getId(), callback);
node.report(DatagramAdapter.VerboseLevel.DETAILED, "notifyFollowerSubscribers: put callback ", callback.getId().toBase64String());
CallbackNotification deferredNotification = deferredCallbackNotifications.get(callback.getId());
if (deferredNotification != null) {
callback.obtainNotification(deferredNotification);
deferredCallbackNotifications.remove(callback.getId());
node.report(DatagramAdapter.VerboseLevel.DETAILED, "notifyFollowerSubscribers: remove deferred notification for callback ",
callback.getId().toBase64String());
}
}
}