Description
Given the the result from database, e.g.
final List<MobileDevice> devices = repositoryService.allInstances(MobileDevice.class);
When I iterate over list with parallelStream
filteredDevices.parallelStream().forEach(mobileDevice -> {
// my stuff here
});
Then I get this exception
... 134 more Caused by: java.lang.IllegalStateException: No service of type class org.apache.isis.core.runtime.services.metrics.MetricsServiceDefault is available on this at org.apache.isis.core.runtime.services.ServiceInstantiator$2.invoke(ServiceInstantiator.java:217) at org.apache.isis.core.runtime.services.metrics.MetricsServiceDefault_$$_jvstad5_7.postLoad(MetricsServiceDefault_$$_jvstad5_7.java) at org.datanucleus.api.jdo.JDOCallbackHandler.postLoad(JDOCallbackHandler.java:305) at org.datanucleus.state.StateManagerImpl.postLoad(StateManagerImpl.java:4443) at org.datanucleus.state.StateManagerImpl.initialiseForCachedPC(StateManagerImpl.java:645) at org.apache.isis.objectstore.jdo.datanucleus.JDOStateManagerForIsis.initialiseForCachedPC(JDOStateManagerForIsis.java:112) at org.datanucleus.state.ObjectProviderFactoryImpl.newForCachedPC(ObjectProviderFactoryImpl.java:280) at org.datanucleus.ExecutionContextImpl.getObjectFromLevel2Cache(ExecutionContextImpl.java:5210) at org.datanucleus.ExecutionContextImpl.getObjectFromCache(ExecutionContextImpl.java:5101) at org.datanucleus.ExecutionContextImpl.findObject(ExecutionContextImpl.java:3048) at org.datanucleus.store.rdbms.query.PersistentClassROF.getObjectForDatastoreId(PersistentClassROF.java:460) at org.datanucleus.store.rdbms.query.PersistentClassROF.getObject(PersistentClassROF.java:385) at org.datanucleus.store.rdbms.scostore.CollectionStoreIterator.<init>(CollectionStoreIterator.java:100) at org.datanucleus.store.rdbms.scostore.FKSetStore.iterator(FKSetStore.java:1080) at org.datanucleus.store.types.wrappers.backed.Collection.loadFromStore(Collection.java:374) at org.datanucleus.store.types.java8.wrappers.backed.Collection.stream(Collection.java:70) at a1.guidedselling.offer.hardware.MobileDevice.referenceNextDevicePriceForTarifWithoutService(MobileDevice.java:195) at a1.guidedselling.templates.OfferTemplatesRepository.lambda$offerTemplatesFor$1(OfferTemplatesRepository.java:102) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291) at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)