Cleaned up init method

This commit is contained in:
Robinson 2021-04-20 14:13:25 +02:00
parent d19d80f101
commit 15c4312d1e
1 changed files with 1 additions and 8 deletions

View File

@ -27,9 +27,7 @@ import dorkbox.executor.Executor
* @author Rein Raudjärv
* @see ProcessDestroyer
*/
class DestroyerListenerAdapter(destroyer: ProcessDestroyer?) : ProcessListener() {
private val destroyer: ProcessDestroyer
class DestroyerListenerAdapter(private val destroyer: ProcessDestroyer) : ProcessListener() {
override fun afterStart(process: Process, executor: Executor) {
destroyer.add(process)
}
@ -37,9 +35,4 @@ class DestroyerListenerAdapter(destroyer: ProcessDestroyer?) : ProcessListener()
override fun afterStop(process: Process) {
destroyer.remove(process)
}
init {
requireNotNull(destroyer) { "Process destroyer must be provided." }
this.destroyer = destroyer
}
}