mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Warnings.
This commit is contained in:
parent
ab131f3eb0
commit
d4ea37bd81
1 changed files with 6 additions and 9 deletions
|
@ -4,7 +4,6 @@ import com.beust.kobalt.misc.NamedThreadFactory
|
|||
import com.beust.kobalt.misc.ToString
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.google.common.collect.ArrayListMultimap
|
||||
import java.util.*
|
||||
import java.util.concurrent.*
|
||||
|
||||
open class TaskResult2<T>(success: Boolean, val value: T) : TaskResult(success) {
|
||||
|
@ -46,7 +45,7 @@ public class DynamicGraphExecutor<T>(val graph: DynamicGraph<T>,
|
|||
synchronized(graph) {
|
||||
val freeNodes = graph.freeNodes
|
||||
freeNodes.forEach { graph.setStatus(it, DynamicGraph.Status.RUNNING)}
|
||||
log(3, "submitting free nodes ${freeNodes}")
|
||||
log(3, "submitting free nodes $freeNodes")
|
||||
val callables : List<IWorker<T>> = factory.createWorkers(freeNodes)
|
||||
callables.forEach { completion.submit(it) }
|
||||
var n = callables.size()
|
||||
|
@ -56,7 +55,7 @@ public class DynamicGraphExecutor<T>(val graph: DynamicGraph<T>,
|
|||
try {
|
||||
val future = completion.take()
|
||||
val taskResult = future.get(2, TimeUnit.SECONDS)
|
||||
log(3, "Received task result ${taskResult}")
|
||||
log(3, "Received task result $taskResult")
|
||||
n--
|
||||
graph.setStatus(taskResult.value,
|
||||
if (taskResult.success) {
|
||||
|
@ -78,8 +77,6 @@ public class DynamicGraphExecutor<T>(val graph: DynamicGraph<T>,
|
|||
* Representation of the graph of methods.
|
||||
*/
|
||||
public class DynamicGraph<T> {
|
||||
private val DEBUG = false
|
||||
|
||||
private val nodesReady = linkedSetOf<T>()
|
||||
private val nodesRunning = linkedSetOf<T>()
|
||||
private val nodesFinished = linkedSetOf<T>()
|
||||
|
@ -92,7 +89,7 @@ public class DynamicGraph<T> {
|
|||
* Define a comparator for the nodes of this graph, which will be used
|
||||
* to order the free nodes when they are asked.
|
||||
*/
|
||||
public val comparator : Comparator<T>? = null
|
||||
// public val comparator : Comparator<T>? = null
|
||||
|
||||
enum class Status {
|
||||
READY, RUNNING, FINISHED, ERROR, SKIPPED
|
||||
|
@ -146,7 +143,7 @@ public class DynamicGraph<T> {
|
|||
// }
|
||||
// }
|
||||
|
||||
log(3, "freeNodes: ${result}")
|
||||
log(3, "freeNodes: $result")
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -176,7 +173,7 @@ public class DynamicGraph<T> {
|
|||
private fun setSkipStatus(node: T, status: Status) {
|
||||
dependingOn.get(node).forEach {
|
||||
if (! nodesSkipped.contains(it)) {
|
||||
log(3, "Node skipped: ${it}")
|
||||
log(3, "Node skipped: $it")
|
||||
nodesSkipped.add(it)
|
||||
nodesReady.remove(it)
|
||||
setSkipStatus(it, status)
|
||||
|
@ -194,7 +191,7 @@ public class DynamicGraph<T> {
|
|||
Status.RUNNING -> nodesRunning.add(node)
|
||||
Status.FINISHED -> nodesFinished.add(node)
|
||||
Status.ERROR -> {
|
||||
log(3, "Node in error: ${node}")
|
||||
log(3, "Node in error: $node")
|
||||
nodesReady.remove(node)
|
||||
nodesInError.add(node)
|
||||
setSkipStatus(node, status)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue