What is the right way to implement a "Selenium driver pool" in Java?
<p>I wrote a web automation tool using Selenium WebDriver and the geckodriver in Java.
Currently every time I execute the task, a new FirefoxDriver object is instantiated.</p>

<p>Now I want to implement multithreading. The first approach that came to my mind was building something like a fixed size pool - instantiate X FirefoxDriver objects at launch, wrap them in an object with a "inUse" flag and use a singleton to manage these instances.</p>

<p>But is this the proper solution? This is my first Selenium project and the whole concept is new to me.
I wasn't able to find an answer to that question myself after several days of googling and reading the documentation now. I would really appreciate your help!</p>