Source:
<code>private void produceQueue() { while (!Thread.currentThread().isInterrupted()) { BlockWrapper wrapper = null; try { wrapper = blockQueue.take(); logger.debug("BlockQueue size: {}, headers queue size: {}", blockQueue.size(), syncQueue.getHeadersCount()); ImportResult importResult = blockchain.tryToConnect(wrapper.getBlock()); if (importResult == IMPORTED_BEST) { logger.info("Success importing BEST: block.number: {}, block.hash: {}, tx.size: ", wrapper.getNumber(), wrapper.getBlock().getShortHash(), wrapper.getBlock().getTransactionsList().size()); if (wrapper.isNewBlock() && !syncDone) { syncDone = true; channelManager.onSyncDone(true); compositeEthereumListener.onSyncDone(); } } if (importResult == IMPORTED_NOT_BEST) logger.info("Success importing NOT_BEST: block.number: {}, block.hash: {}, tx.size: ", wrapper.getNumber(), wrapper.getBlock().getShortHash(), wrapper.getBlock().getTransactionsList().size()); if (syncDone && (importResult == IMPORTED_BEST || importResult == IMPORTED_NOT_BEST)) { if (logger.isDebugEnabled()) logger.debug("Block dump: " + Hex.toHexString(wrapper.getBlock().getEncoded())); if (wrapper.isNewBlock()) { Channel receivedFrom = channelManager.getActivePeer(wrapper.getNodeId()); channelManager.sendNewBlock(wrapper.getBlock(), receivedFrom); <START> } <END> } if (importResult == NO_PARENT) { logger.error("No parent on the chain for block.number: block.hash: {}", wrapper.getNumber(), wrapper.getBlock().getShortHash()); } } catch (InterruptedException e) { break; } catch (Throwable e) { logger.error("Error processing block {}: ", wrapper.getBlock().getShortDescr(), e); logger.error("Block dump: {}", Hex.toHexString(wrapper.getBlock().getEncoded())); } } }</code><technical_language>please submit this logic a separate async executor? This code do blocking stuff in current implementation, prefer invoke network related stuff asynchronously this method for case</technical_language>

Target:
private void produceQueue() { while (!Thread.currentThread().isInterrupted()) { BlockWrapper wrapper = null; try { wrapper = blockQueue.take(); logger.debug("BlockQueue size: {}, headers queue size: {}", blockQueue.size(), syncQueue.getHeadersCount()); ImportResult importResult = blockchain.tryToConnect(wrapper.getBlock()); if (importResult == IMPORTED_BEST) { logger.info("Success importing BEST: block.number: {}, block.hash: {}, tx.size: ", wrapper.getNumber(), wrapper.getBlock().getShortHash(), wrapper.getBlock().getTransactionsList().size()); if (wrapper.isNewBlock() && !syncDone) { syncDone = true; channelManager.onSyncDone(true); compositeEthereumListener.onSyncDone(); } } if (importResult == IMPORTED_NOT_BEST) logger.info("Success importing NOT_BEST: block.number: {}, block.hash: {}, tx.size: ", wrapper.getNumber(), wrapper.getBlock().getShortHash(), wrapper.getBlock().getTransactionsList().size()); if (syncDone && (importResult == IMPORTED_BEST || importResult == IMPORTED_NOT_BEST)) { if (logger.isDebugEnabled()) logger.debug("Block dump: " + Hex.toHexString(wrapper.getBlock().getEncoded())); if (wrapper.isNewBlock()) newBlocks.add(wrapper); } if (importResult == NO_PARENT) { logger.error("No parent on the chain for block.number: block.hash: {}", wrapper.getNumber(), wrapper.getBlock().getShortHash()); } } catch (InterruptedException e) { break; } catch (Throwable e) { if (wrapper != null) { logger.error("Error processing block {}: ", wrapper.getBlock().getShortDescr(), e); logger.error("Block dump: {}", Hex.toHexString(wrapper.getBlock().getEncoded())); } else { logger.error("Error processing unknown block", e); } } } }