Source:
<code>LineTcpMeasurementScheduler(CairoConfiguration cairoConfiguration, LineTcpReceiverConfiguration lineConfiguration, CairoEngine engine, WorkerPool writerWorkerPool) { this.engine = engine; this.securityContext = lineConfiguration.getCairoSecurityContext(); this.cairoConfiguration = cairoConfiguration; this.milliClock = cairoConfiguration.getMillisecondClock(); tableUpdateDetailsByTableName = new CharSequenceObjHashMap<>(); loadByThread = new int[writerWorkerPool.getWorkerCount()]; int maxMeasurementSize = lineConfiguration.getMaxMeasurementSize(); int queueSize = lineConfiguration.getWriterQueueSize(); queue = new RingQueue<>(() -> { return new LineTcpMeasurementEvent(maxMeasurementSize, lineConfiguration.getMicrosecondClock(), lineConfiguration.getTimestampAdapter()); }, queueSize); pubSeq = new SPSequence(queueSize); int nWriterThreads = writerWorkerPool.getWorkerCount(); Sequence[] subSeqById = new Sequence[nWriterThreads]; if (nWriterThreads > 1) { FanOut fanOut = new FanOut(); for (int n = 0, sz = nWriterThreads; n < sz; n++) { SCSequence subSeq = new SCSequence(); fanOut.and(subSeq); subSeqById[n] = subSeq; WriterJob writerJob = new WriterJob(n, subSeq); writerWorkerPool.assign(n, writerJob); <START> writerWorkerPool.assign(n, writerJob::close); <END> } pubSeq.then(fanOut).then(pubSeq); } else { SCSequence subSeq = new SCSequence(); pubSeq.then(subSeq).then(pubSeq); WriterJob writerJob = new WriterJob(0, subSeq); writerWorkerPool.assign(0, writerJob); writerWorkerPool.assign(0, writerJob::close); } nUpdatesPerLoadRebalance = lineConfiguration.getnUpdatesPerLoadRebalance(); maxLoadRatio = lineConfiguration.getMaxLoadRatio(); maxUncommittedRows = lineConfiguration.getMaxUncommittedRows(); maintenanceJobHysteresisInMs = lineConfiguration.getMaintenanceJobHysteresisInMs(); }</code><technical_language>minor here, creating identical lambdas in a loop</technical_language>

Target:
LineTcpMeasurementScheduler(CairoConfiguration cairoConfiguration, LineTcpReceiverConfiguration lineConfiguration, CairoEngine engine, WorkerPool writerWorkerPool) { this.engine = engine; this.securityContext = lineConfiguration.getCairoSecurityContext(); this.cairoConfiguration = cairoConfiguration; this.milliClock = cairoConfiguration.getMillisecondClock(); tableUpdateDetailsByTableName = new CharSequenceObjHashMap<>(); loadByThread = new int[writerWorkerPool.getWorkerCount()]; int maxMeasurementSize = lineConfiguration.getMaxMeasurementSize(); int queueSize = lineConfiguration.getWriterQueueSize(); queue = new RingQueue<>(() -> new LineTcpMeasurementEvent(maxMeasurementSize, lineConfiguration.getMicrosecondClock(), lineConfiguration.getTimestampAdapter()), queueSize); pubSeq = new SPSequence(queueSize); int nWriterThreads = writerWorkerPool.getWorkerCount(); if (nWriterThreads > 1) { FanOut fanOut = new FanOut(); for (int n = 0; n < nWriterThreads; n++) { SCSequence subSeq = new SCSequence(); fanOut.and(subSeq); WriterJob writerJob = new WriterJob(n, subSeq); writerWorkerPool.assign(n, writerJob); writerWorkerPool.assign(n, writerJob::close); } pubSeq.then(fanOut).then(pubSeq); } else { SCSequence subSeq = new SCSequence(); pubSeq.then(subSeq).then(pubSeq); WriterJob writerJob = new WriterJob(0, subSeq); writerWorkerPool.assign(0, writerJob); writerWorkerPool.assign(0, writerJob::close); } nUpdatesPerLoadRebalance = lineConfiguration.getnUpdatesPerLoadRebalance(); maxLoadRatio = lineConfiguration.getMaxLoadRatio(); maxUncommittedRows = lineConfiguration.getMaxUncommittedRows(); maintenanceJobHysteresisInMs = lineConfiguration.getMaintenanceJobHysteresisInMs(); }