[英]BufferedReader.lines() method locking up on Windows
所以我有調用BufferedReader.lines()的代碼。
EIPLogManager2.getServerLogger().info("Got header row: " + headerRow); //TODO delete this
List<String> allBatches = reader.lines()
.skip(forkCount > 0 ? forkCount * forkSize : 0)
.limit(transactionsRemaining.get() * forkSize)
.collect(Collectors.toList());
EIPLogManager2.getServerLogger().info("Got all batches. Size: " + allBatches.size()); //TODO delete this
讓我解釋一下這段代碼的行為:
1)在我的Mac上運行它。 完美運作。
2)在Windows上運行。 標頭行日志條目會打印出來,但是“獲取所有批次”日志條目從不執行。 在流中似乎凍結了。
TransactionsRemaining.get()調用是對AtomicInteger的。
我不知道為什么在Windows上會發生這種情況。 這個不成立。 我已經在JRE 8和JRE 11中看到了這種行為。
幫助或建議,將不勝感激。
好吧,我很傻。 因此,forkSize和transactionRemaining變量由用戶輸入設置。 用戶已將transactionsRemaining設置為1,000,000,000,因此limit()上的數學運算產生的值大於Integer.MAX_VALUE。 然后引發了IllegalArgumentException,我想我沒有任何東西可以向我報告該異常。
現在問題已解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.