use of com.quorum.tessera.p2p.resend.TransactionRequester in project tessera by ConsenSys.
the class ScheduledServiceFactory method build.
public void build() {
IntervalPropertyHelper intervalPropertyHelper = new IntervalPropertyHelper(config.getP2PServerConfig().getProperties());
LOGGER.info("Creating p2p client");
P2pClient p2pClient = P2pClient.create();
LOGGER.info("Created p2p client {}", p2pClient);
if (enableSync) {
ResendPartyStore resendPartyStore = ResendPartyStore.create();
TransactionRequester transactionRequester = TransactionRequester.create();
SyncPoller syncPoller = new SyncPoller(resendPartyStore, transactionRequester, p2pClient);
ScheduledExecutorService scheduledExecutorService = java.util.concurrent.Executors.newSingleThreadScheduledExecutor();
tesseraScheduledExecutors.add(new TesseraScheduledExecutor(scheduledExecutorService, syncPoller, intervalPropertyHelper.syncInterval(), 5000L));
}
LOGGER.info("Creating EnclaveKeySynchroniser");
final EnclaveKeySynchroniser enclaveKeySynchroniser = ServiceLoader.load(EnclaveKeySynchroniser.class).stream().map(ServiceLoader.Provider::get).findFirst().get();
LOGGER.info("Created EnclaveKeySynchroniser {}", enclaveKeySynchroniser);
tesseraScheduledExecutors.add(new TesseraScheduledExecutor(java.util.concurrent.Executors.newSingleThreadScheduledExecutor(), () -> enclaveKeySynchroniser.syncKeys(), intervalPropertyHelper.enclaveKeySyncInterval(), 5000L));
LOGGER.info("Creating PartyInfoBroadcaster");
PartyInfoBroadcaster partyInfoPoller = new PartyInfoBroadcaster(p2pClient);
LOGGER.info("Created PartyInfoBroadcaster {}", partyInfoPoller);
tesseraScheduledExecutors.add(new TesseraScheduledExecutor(java.util.concurrent.Executors.newSingleThreadScheduledExecutor(), partyInfoPoller, intervalPropertyHelper.partyInfoInterval(), 5000L));
tesseraScheduledExecutors.forEach(TesseraScheduledExecutor::start);
LOGGER.info("Creating Enclave");
Enclave enclave = Enclave.create();
LOGGER.info("Created Enclave {}", enclave);
serviceContainer = new ServiceContainer(enclave);
LOGGER.info("Starting Enclave");
serviceContainer.start();
LOGGER.info("Started Enclave");
}
Aggregations