3 weeks ago
Hi,
I am trying to use the java 8 parllelStream() feature to read and update the models, but
Getting below error:
INFO | jvm 1 | main | 2024/05/02 03:25:12.976 | [m
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | [32mINFO [hybrisHTTP26] [AbstractRestHandlerExceptionResolver] Translating exception [java.lang.IllegalStateException]: java.lang.IllegalStateException: no tenant active. if you do not want to use tenants, call Registry.activateMasterTenant() to assure the Master tenant is active.
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | [m[1;31mERROR [hybrisHTTP26] [AbstractRestHandlerExceptionResolver] java.lang.IllegalStateException: java.lang.IllegalStateException: no tenant active. if you do not want to use tenants, call Registry.activateMasterTenant() to assure the Master tenant is active.
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:562)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:591)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:689)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 | at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:765)
INFO | jvm 1 | main | 2024/05/02 03:25:13.081 |
Don't use Java 8 parallelStreams while performing persistence operations.
SAP Commerce Cloud's persistence layer (and multi-threading capabilities) is not designed for use with parallelStreams. Creating another thread via the parallelStreams lacks the Tenant context, making SAP Commerce persistence impossible in the parallel streams
See the following for more details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.