我只是想知道是否有可能在启动事件函数内创建parallelStream。我现在发现quarkus,为了进行测试,我必须在启动时读取文件并将其文件插入数据库。每当尝试使用parallelStream
代替普通的ACCESS_VIOLATION_EXCEPTION
时,我都会得到void onStart(@Observes StartupEvent ev) throws Exception {
// Parsing the file, getting the iterator
it.readAll().stream().forEach(this::operateEntry);
}
@Transactional
void operateEntry(Entry entry) {
// Performing the database actions for a single entry
}
。
这里有一些代码,您可以想象我在做什么。此示例有效。
void onStart(@Observes StartupEvent ev) throws Exception {
// Parsing the file, getting the iterator
it.readAll().parallelStream().forEach(this::operateEntry);
}
使用相同的示例,但是这次使用并行流会导致错误:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd5e59bf40, pid=15880, tid=20388
#
# JRE version: Java(TM) SE Runtime Environment (11.0.1+13) (build 11.0.1+13-LTS)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.1+13-LTS, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# V [jvm.dll+0x1ebf40]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# D:\knowledge\curator-service\target\hs_err_pid15880.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
错误消息
messages
我知道在每个quarkus启动中解析大量数据可能不是现实的用例。但是我想了解为什么这不起作用。感谢您的建议。
谢谢。