All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.enodeframework.messaging.impl.RootDispatching.kt Maven / Gradle / Ivy

package org.enodeframework.messaging.impl

import java.util.concurrent.CompletableFuture
import java.util.concurrent.ConcurrentHashMap

class RootDispatching {
    val taskCompletionSource: CompletableFuture = CompletableFuture()
    private val childDispatchingDict: ConcurrentHashMap = ConcurrentHashMap()

    fun addChildDispatching(childDispatching: Any) {
        childDispatchingDict[childDispatching] = false
    }

    fun onChildDispatchingFinished(childDispatching: Any) {
        if (childDispatchingDict.remove(childDispatching) != null) {
            if (childDispatchingDict.isEmpty()) {
                taskCompletionSource.complete(true)
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy