<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Lately at work I have been working on a piece of Java 8 code (in
      our Big Ball of Mud) that reminds me of Structured Concurrency.</p>
    <p>It is a concurrent/parallel execution framework that uses <br>
    </p>
    <blockquote>
      <p><font face="Courier New, Courier, monospace">final static
          ExecutorService _executorService =
          Executors.newFixedThreadPool(50);<br>
        </font></p>
      <p><font face="Courier New, Courier, monospace">CompletionService<ObjectNode>
          completionService = new
          ExecutorCompletionService(executorService());</font></p>
    </blockquote>
    <p>I have since changed this to</p>
    <blockquote>
      <p><font face="Courier New, Courier, monospace">static
          ExecutorService _executorService =
          Executors.newWorkStealingPool();</font><br>
      </p>
    </blockquote>
    <p>Until recently, I was not familiar with <font face="Courier New,
        Courier, monospace">CompletionService</font>, but after my
      recent experiments in Loom Structured Concurrency, it reminded me
      a little of Structured Concurrency. Certainly not as nice as <font
        face="Courier New, Courier, monospace">StructuredTaskScope</font>,
      but similar in form.</p>
    <p>One of my goals is to refactor our code using Java 19 <font
        face="Courier New, Courier, monospace">StructuredTaskScope</font>,
      but that may be a while. In the meantime, I plan to experiment
      with it.</p>
    <p><i><b>Having no prior experience with </b></i><i><b><font
            face="Courier New, Courier, monospace">CompletionService</font></b></i><i><b>
          I was wondering if anyone knows the history of it, and was is
          an early attempt at Structured Concurrency?</b></i></p>
    <p>Cheers, Eric<br>
    </p>
  </body>
</html>