class SyncPoller implements Runnable {

    @Override
    public void run() {

        NodeInfo currentNodeInfo = discovery.getCurrent();

        final PartyInfo partyInfo =
            PartyInfoBuilder.create()
                .withUri(currentNodeInfo.getUrl())
                .withRecipients(currentNodeInfo.getRecipientsAsMap())
                .build();

        final Set<Party> unseenParties =
            partyInfo.getParties().stream()
                .filter(p -> !p.getUrl().equals(partyInfo.getUrl()))
                .collect(Collectors.toSet());
        LOGGER.debug("Unseen parties {}", unseenParties);
        this.resendPartyStore.addUnseenParties(unseenParties);

        Optional<SyncableParty> nextPartyToSend = this.resendPartyStore.getNextParty();

        while (nextPartyToSend.isPresent()) {

            final SyncableParty requestDetails = nextPartyToSend.get();
            final String url = requestDetails.getParty().getUrl();

            final Runnable action =
                () -> {

                    // perform a sendPartyInfo in order to ensure that the target tessera has the current tessera as
                    // a recipient
                    boolean allSucceeded = updatePartyInfo(url);

                    if (allSucceeded) {
                        allSucceeded = this.transactionRequester.requestAllTransactionsFromNode(url);
                    }

                    if (!allSucceeded) {
                        this.resendPartyStore.incrementFailedAttempt(requestDetails);
                    }
                };

            this.executorService.submit(action);

            nextPartyToSend = this.resendPartyStore.getNextParty();
        }
    }

    public  SyncPoller(
        ResendPartyStore resendPartyStore, TransactionRequester transactionRequester, P2pClient p2pClient);
    public  SyncPoller(
        final ExecutorService executorService,
        final ResendPartyStore resendPartyStore,
        final TransactionRequester transactionRequester,
        final Discovery discovery,
        final PartyInfoParser partyInfoParser,
        final P2pClient p2pClient);

}