-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from bpm-crafters/feature/improving_c8
Iimproving C8 Adapter
- Loading branch information
Showing
35 changed files
with
641 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...otlin/dev/bpmcrafters/processengineapi/adapter/c8/task/completion/FailureRetrySupplier.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.bpmcrafters.processengineapi.adapter.c8.task.completion | ||
|
||
import java.util.function.Function | ||
|
||
@FunctionalInterface | ||
interface FailureRetrySupplier : Function<String, FailureRetrySupplier.FailureRetry> { | ||
|
||
data class FailureRetry( | ||
val retryCount: Int, | ||
val retryTimeout: Long | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
...mcrafters/processengineapi/adapter/c8/task/completion/LinearMemoryFailureRetrySupplier.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dev.bpmcrafters.processengineapi.adapter.c8.task.completion | ||
|
||
class LinearMemoryFailureRetrySupplier( | ||
private val retry: Int, | ||
private val retryTimeout: Long | ||
) : FailureRetrySupplier { | ||
|
||
private val taskFailures: MutableMap<String, FailureRetrySupplier.FailureRetry> = mutableMapOf() | ||
|
||
override fun apply(taskId: String): FailureRetrySupplier.FailureRetry { | ||
val last = taskFailures.getOrPut(taskId) { FailureRetrySupplier.FailureRetry(retryCount = retry, retryTimeout = retryTimeout) } | ||
val new = last.copy(retryCount = (last.retryCount - 1).coerceAtLeast(0)) // there must be no negative retries ever | ||
taskFailures[taskId] = new | ||
return new | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.