Source:
<code>public void queueOrderedByTransaction() throws Exception { final int numThreads = PARAMETERS.CONCURRENCY_TWO; Map<Long, Long> conflictMap = instantiateCorfuObject(SMRMap.class, "conflictMap"); CorfuQueue<String> corfuQueue = new CorfuQueue<>(getRuntime(), "testQueue"); class Record { @Getter public UUID id; @Getter public String data; public Record(UUID id, String data) { this.id = id; this.data = data; } } ArrayList<Record> validator = new ArrayList<>(numThreads * numIterations); ReentrantLock lock = new ReentrantLock(); <START> scheduleConcurrently(numThreads, t -> { <END> for (Long i = 0L; i < numIterations; i++) { String queueData = t.toString()+":"+i.toString(); try { TXBegin(); Long coinToss = new Random().nextLong() % numConflictKeys; conflictMap.put(coinToss, coinToss); UUID id = corfuQueue.enqueue(queueData); lock.lock(); final long streamOffset = TXEnd(); validator.add(new Record(id, queueData)); log.debug("ENQ:"+id+"=>"+queueData+" at "+streamOffset); lock.unlock(); } catch (TransactionAbortedException txException) { log.debug(queueData+" ---> Abort!!! "); lock.unlock(); } } }); executeScheduled(numThreads, PARAMETERS.TIMEOUT_LONG); List<CorfuQueueRecord<String>> records = corfuQueue.entryList(-1); assertThat(validator.size()).isEqualTo(records.size()); for (int i = 0 ; i < validator.size(); i++) { log.debug("Entry:"+records.get(i).getID()); assertThat(validator.get(i).getData()).isEqualTo(records.get(i).getEntry()); assertThat(validator.get(i).getId().getLeastSignificantBits()). isEqualTo(records.get(i).getID().getLeastSignificantBits()); } }</code><technical_language>please reformat code</technical_language>

Target:
public void queueOrderedByTransaction() throws Exception { final int numThreads = PARAMETERS.CONCURRENCY_TWO; Map<Long, Long> conflictMap = instantiateCorfuObject(SMRMap.class, "conflictMap"); CorfuQueue<String> corfuQueue = new CorfuQueue<>(getRuntime(), "testQueue"); class Record { @Getter public CorfuRecordId id; @Getter public String data; public Record(CorfuRecordId id, String data) { this.id = id; this.data = data; } } ArrayList<Record> validator = new ArrayList<>(numThreads * numIterations); ReentrantLock lock = new ReentrantLock(); scheduleConcurrently(numThreads, t -> { for (Long i = 0L; i < numIterations; i++) { String queueData = t.toString() + ":" + i.toString(); try { TXBegin(); Long coinToss = new Random().nextLong() % numConflictKeys; conflictMap.put(coinToss, coinToss); CorfuRecordId id = corfuQueue.enqueue(queueData); lock.lock(); final long streamOffset = TXEnd(); validator.add(new Record(id, queueData)); log.debug("ENQ:" + id + "=>" + queueData + " at " + streamOffset); } catch (TransactionAbortedException txException) { log.debug(queueData + " ---> Abort!!! "); } finally { lock.unlock(); } } }); executeScheduled(numThreads, PARAMETERS.TIMEOUT_LONG); List<CorfuQueue.CorfuQueueRecord<String>> records = corfuQueue.entryList(); assertThat(validator.size()).isEqualTo(records.size()); for (int i = 0; i < validator.size(); i++) { log.debug("Entry:" + records.get(i).getRecordId()); assertThat(validator.get(i).getId().equals(records.get(i).getRecordId())); assertThat(validator.get(i).getData()).isEqualTo(records.get(i).getEntry()); } assertThatThrownBy(() -> validator.get(0).getId().compareTo(records.get(0).getRecordId())). isExactlyInstanceOf(IllegalArgumentException.class); }