O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

Follow these steps to implement the example:

  1. Create a class named FolderProcessor and specify that it extends the CountedCompleter class parameterized with the List<String> type:
        public class FolderProcessor extends                                CountedCompleter<List<String>> { 
  1. Declare a private String attribute named path. This attribute will store the full path of the folder the task is going to process:
        private String path; 
  1. Declare a private String attribute named extension. This attribute will store the name of the extension of the files the task is going to look for:
        private String extension; 
  1. Declare two List private attributes named tasks and resultList. We will use the first one to store all the child tasks launched from this task and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required