Project Build thread pool shutdown

Our project uses fixed thread pool (n daemon threads), when running build with gradle daemon each build adds n threads to gradle daemon process. From what hook should I shutdown the pool to avoid leakage?

Thanks, Alexey

Probably ‘gradle.buildFinished’.