{"id":61751,"date":"2016-11-11T13:00:40","date_gmt":"2016-11-11T11:00:40","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=61751"},"modified":"2016-11-11T11:15:57","modified_gmt":"2016-11-11T09:15:57","slug":"work-parallel-database-streams-using-custom-thread-pools","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html","title":{"rendered":"Work with Parallel Database Streams using Custom Thread Pools"},"content":{"rendered":"<h2>Parallel Database Streams<\/h2>\n<p>In my\u00a0<a href=\"https:\/\/www.javacodegeeks.com\/2016\/10\/work-parallel-database-streams-using-java-8.html\" target=\"_blank\">previous post<\/a>, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel streams can, under many circumstances, be significantly faster than the usual sequential database streams.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n<figure id=\"attachment_61753\" aria-describedby=\"caption-attachment-61753\" style=\"width: 320px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/Pool.png\"><img decoding=\"async\" class=\"size-full wp-image-61753\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/Pool.png\" alt=\"The Thread Pool\" width=\"320\" height=\"208\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/Pool.png 320w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/Pool-300x195.png 300w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><figcaption id=\"caption-attachment-61753\" class=\"wp-caption-text\">The Thread Pool<\/figcaption><\/figure><\/p>\n<p><a href=\"https:\/\/github.com\/speedment\/speedment\" target=\"_blank\"><br \/>\nSpeedment<\/a> is an open-source Stream ORM Java Toolkit and Runtime Java tool that wraps an existing database and its tables into Java 8 streams. We can use an existing database and run the Speedment tool and it will generate POJO classes that corresponds to the tables we have selected using the tool. One distinct feature with Speedment is that it supports parallel database streams and that it can use different parallel strategies to further optimize performance.By default, parallel streams are executed on the common \u00a0<code>ForkJoinPool<\/code>\u00a0where they potentially might compete with other tasks. In this post we will learn how we can execute parallell database streams on our own custom<br \/>\nForkJoinPool, allowing a much better control of our execution environment.<\/p>\n<h2>Getting Started With Speedment<\/h2>\n<p>Head out to \u00a0<a href=\"https:\/\/github.com\/speedment\/speedment\" target=\"_blank\">open-souce Speedment<\/a>\u00a0on GitHub and learn how to get started with a Speedment project. Connecting the tool to an existing database is really easy. Read my<br \/>\n<a href=\"http:\/\/minborgsjavapot.blogspot.com\/2016\/10\/work-with-parallel-database-streams.html\" target=\"_blank\">previous post<\/a> for more information on how the database table and PrimeUtil class looks like for the examples below.<\/p>\n<h2>Executing on the Default ForkJoinPool<\/h2>\n<p>Here is the application that I talked about in my previous post that will scan a database table in parallel for undetermined prime number candidates and then it will determine if they are primes or not and update the table accordingly. This is how it looks:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java; wrap-lines:false\">Manager&lt;PrimeCandidate&gt; candidatesHigh = app.configure(PrimeCandidateManager.class)\r\n            .withParallelStrategy(ParallelStrategy.computeIntensityHigh())\r\n            .build();\r\n\r\n        candidatesHigh.stream() \r\n            .parallel()                                                \/\/ Use a parallel stream\r\n            .filter(PrimeCandidate.PRIME.isNull())                     \/\/ Only consider nondetermined prime candidates\r\n            .map(pc -&gt; pc.setPrime(PrimeUtil.isPrime(pc.getValue())))  \/\/ Sets if it is a prime or not\r\n            .forEach(candidatesHigh.updater());                        \/\/ Apply the Manager's updater<\/pre>\n<p>First, we create a stream over all candidates (using a parallel strategy named ParallelStrategy.computeIntensityHigh()) where the &#8216;prime&#8217; column is \u00a0<code>null<\/code>\u00a0using the <code>stream().filter(PrimeCandidate.PRIME.isNull())<\/code>\u00a0method. Then, for each such prime candidate pc, we either set the &#8216;prime&#8217; column to \u00a0<code>true<\/code>\u00a0if \u00a0<code>pc.getValue()<\/code>\u00a0is a prime or \u00a0<code>false<\/code>\u00a0if \u00a0<code>pc.getValue()<\/code>\u00a0is not a prime. Interestingly, the \u00a0<code>pc.setPrime()<\/code>\u00a0method returns the entity pc itself, allowing us to easily tag on multiple stream operations. On the last line, we update the database with the result of our check by applying the \u00a0<code>candidatesHigh.updater()<\/code>\u00a0function.<\/p>\n<p>Again, make sure to check out my\u00a0<a href=\"https:\/\/www.javacodegeeks.com\/2016\/10\/work-parallel-database-streams-using-java-8.html\" target=\"_blank\">previous post<\/a> on the details and benefits of parallel strategies. In short, Java&#8217;s default parallel strategy works well for low computational demands because it places a large amount of initial work items on each thread. Speedment&#8217;s parallel strategies works much better for medium to high computational demands whereby a small amount of work items are laid out on the participating threads.<\/p>\n<p>The stream will determine prime numbers fully parallel and the execution threads will use the common \u00a0\u00a0<code>ForkJoinPool<\/code>\u00a0as can be seen in this picture (my laptop has 4 CPU cores and 8 CPU threads):<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/CommonForkJoinPool.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-61754\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/CommonForkJoinPool.png\" alt=\"commonforkjoinpool\" width=\"320\" height=\"224\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/CommonForkJoinPool.png 320w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/CommonForkJoinPool-300x210.png 300w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><\/p>\n<h2>Use a Custom Executor Service<\/h2>\n<p>As we learned in the beginning of this post, parallel streams are executed by the common<br \/>\n<code>ForkJoinPool<\/code>\u00a0by default. But, sometimes we want to use our own Executor, perhaps because we are afraid of flooding the common<br \/>\n<code>ForkJoinPool<\/code>, so that other tasks cannot run properly. Defining our own executor can easily be done for Speedment (and other stream libraries) like this:<\/p>\n<pre class=\"brush:java\">final ForkJoinPool forkJoinPool = new ForkJoinPool(3);\r\n    forkJoinPool.submit(() -&gt; \r\n        \r\n        candidatesHigh.stream() \r\n            .parallel()\r\n            .filter(PrimeCandidate.PRIME.isNull())\r\n            .map(pc -&gt; pc.setPrime(PrimeUtil.isPrime(pc.getValue())))\r\n            .forEach(candidatesHigh.updater()); \r\n            \r\n    );\r\n\r\n    try {\r\n        forkJoinPool.shutdown();\r\n        forkJoinPool.awaitTermination(1, TimeUnit.HOURS);\r\n    } catch (InterruptedException ie) {\r\n        ie.printStackTrace();\r\n    }<\/pre>\n<p>The application code is unmodified, but wrapped into a custom \u00a0<code>ForkJoinPool<\/code>\u00a0that we can control ourselves. In the example above, we setup a thread pool with just three worker threads. The worker threads are not shared with the threads in the common \u00a0<code>ForkJoinPool<\/code>.<\/p>\n<p>Here is how the threads looks like using the custom executor service:<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/CustomExecutor.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-61755\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/CustomExecutor.png\" alt=\"customexecutor\" width=\"320\" height=\"258\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/CustomExecutor.png 320w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2016\/11\/CustomExecutor-300x242.png 300w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><\/p>\n<p>This way we can control both the actual \u00a0<code>ThreadPool<\/code>\u00a0itself and precisely how work items are laid out in that pool using a parallel strategy!<\/p>\n<p>Keep up the heat in your pools!<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/minborgsjavapot.blogspot.com\/2016\/11\/work-with-parallel-database-streams.html\">Work with Parallel Database Streams using Custom Thread Pools<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\">JCG partner<\/a> Per Minborg at the <a href=\"http:\/\/minborgsjavapot.blogspot.com\/\">Minborg&#8217;s Java Pot<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Parallel Database Streams In my\u00a0previous post, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel streams can, under many circumstances, be significantly faster than the usual sequential database streams. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Speedment is an open-source Stream ORM Java Toolkit and Runtime Java tool that wraps an &hellip;<\/p>\n","protected":false},"author":1012,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[662],"class_list":["post-61751","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-databases"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Work with Parallel Database Streams using Custom Thread Pools - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Parallel Database Streams In my\u00a0previous post, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Work with Parallel Database Streams using Custom Thread Pools - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Parallel Database Streams In my\u00a0previous post, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-11-11T11:00:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Per Minborg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Per Minborg\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html\"},\"author\":{\"name\":\"Per Minborg\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/fa1fcf5d879f0a50f8b9dff5f93149a7\"},\"headline\":\"Work with Parallel Database Streams using Custom Thread Pools\",\"datePublished\":\"2016-11-11T11:00:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html\"},\"wordCount\":636,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"Databases\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html\",\"name\":\"Work with Parallel Database Streams using Custom Thread Pools - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2016-11-11T11:00:40+00:00\",\"description\":\"Parallel Database Streams In my\u00a0previous post, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/11\\\/work-parallel-database-streams-using-custom-thread-pools.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Work with Parallel Database Streams using Custom Thread Pools\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/fa1fcf5d879f0a50f8b9dff5f93149a7\",\"name\":\"Per Minborg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g\",\"caption\":\"Per Minborg\"},\"description\":\"I am a guy living in Palo Alto, California, but I am originally from Sweden. I am working as CTO on Speedment with Java and database application acceleration. Check it out on www.speedment.com\",\"sameAs\":[\"http:\\\/\\\/minborgsjavapot.blogspot.co.nz\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/per-minborg\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Work with Parallel Database Streams using Custom Thread Pools - Java Code Geeks","description":"Parallel Database Streams In my\u00a0previous post, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html","og_locale":"en_US","og_type":"article","og_title":"Work with Parallel Database Streams using Custom Thread Pools - Java Code Geeks","og_description":"Parallel Database Streams In my\u00a0previous post, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel","og_url":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-11-11T11:00:40+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Per Minborg","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Per Minborg","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html"},"author":{"name":"Per Minborg","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/fa1fcf5d879f0a50f8b9dff5f93149a7"},"headline":"Work with Parallel Database Streams using Custom Thread Pools","datePublished":"2016-11-11T11:00:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html"},"wordCount":636,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["Databases"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html","url":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html","name":"Work with Parallel Database Streams using Custom Thread Pools - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2016-11-11T11:00:40+00:00","description":"Parallel Database Streams In my\u00a0previous post, I wrote about processing database content in parallel using parallel streams and Speedment. Parallel","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2016\/11\/work-parallel-database-streams-using-custom-thread-pools.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Work with Parallel Database Streams using Custom Thread Pools"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/fa1fcf5d879f0a50f8b9dff5f93149a7","name":"Per Minborg","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g","caption":"Per Minborg"},"description":"I am a guy living in Palo Alto, California, but I am originally from Sweden. I am working as CTO on Speedment with Java and database application acceleration. Check it out on www.speedment.com","sameAs":["http:\/\/minborgsjavapot.blogspot.co.nz\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/per-minborg"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/61751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/1012"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=61751"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/61751\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=61751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=61751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=61751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}