Fixed signature
This commit is contained in:
parent
597adb36bc
commit
c6d842aefc
@ -12,10 +12,10 @@ import kotlin.coroutines.cancellation.CancellationException
|
|||||||
/**
|
/**
|
||||||
* Abstract base class for handling tasks with asynchronous processing and reporting.
|
* Abstract base class for handling tasks with asynchronous processing and reporting.
|
||||||
*
|
*
|
||||||
* @param T The type of result produced by processing the task.
|
|
||||||
* @param reporter An instance of [TaskReporter] for reporting task status and events.
|
* @param reporter An instance of [TaskReporter] for reporting task status and events.
|
||||||
*/
|
*/
|
||||||
abstract class TaskListener<T>(val taskType: TaskType = TaskType.CPU_INTENSIVE): TaskListenerImplementation {
|
abstract class TaskListener(val taskType: TaskType = TaskType.CPU_INTENSIVE): TaskListenerImplementation {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
TaskListenerRegistry.registerListener(this)
|
TaskListenerRegistry.registerListener(this)
|
||||||
|
|||||||
@ -2,6 +2,6 @@ package no.iktdev.eventi.tasks
|
|||||||
|
|
||||||
import no.iktdev.eventi.ListenerRegistryImplementation
|
import no.iktdev.eventi.ListenerRegistryImplementation
|
||||||
|
|
||||||
object TaskListenerRegistry: ListenerRegistryImplementation<TaskListener<*>>() {
|
object TaskListenerRegistry: ListenerRegistryImplementation<TaskListener>() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ class AbstractTaskPollerTest : TestBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
open class EchoListener : TaskListener<String>(TaskType.MIXED) {
|
open class EchoListener : TaskListener(TaskType.MIXED) {
|
||||||
var result: Event? = null
|
var result: Event? = null
|
||||||
|
|
||||||
override fun getWorkerId() = this.javaClass.simpleName
|
override fun getWorkerId() = this.javaClass.simpleName
|
||||||
|
|||||||
@ -15,7 +15,7 @@ fun TaskListenerRegistry.wipe() {
|
|||||||
|
|
||||||
// Tøm map’en
|
// Tøm map’en
|
||||||
val mutableList = field.get(TaskListenerRegistry) as MutableList<*>
|
val mutableList = field.get(TaskListenerRegistry) as MutableList<*>
|
||||||
(mutableList as MutableList<Class<out TaskListener<*>>>).clear()
|
(mutableList as MutableList<Class<out TaskListener>>).clear()
|
||||||
|
|
||||||
// Verifiser at det er tomt
|
// Verifiser at det er tomt
|
||||||
assertThat(TaskListenerRegistry.getListeners().isEmpty())
|
assertThat(TaskListenerRegistry.getListeners().isEmpty())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user