Created
March 30, 2020 09:21
-
-
Save mig35/683de4a52b3ee0899b69b0fe2c37ec5f to your computer and use it in GitHub Desktop.
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
open class ConcurrentStrategyWithTag(private val tag: Any) : ConcurrentStrategy() { | |
override fun shouldAddToPendingActions( | |
pendingActionCommands: RemoveOnlyList<ActionCommand<*, *>>, | |
runningActionCommands: List<ActionCommand<*, *>> | |
): Boolean { | |
pendingActionCommands.removeAll { command -> | |
command.strategy.let { it is ConcurrentStrategyWithTag && it.tag == tag } | |
} | |
return true | |
} | |
override fun shouldExecuteAction( | |
pendingActionCommands: RemoveOnlyList<ActionCommand<*, *>>, | |
runningActionCommands: List<ActionCommand<*, *>> | |
): Boolean = | |
!runningActionCommands.any { command -> | |
command.strategy.let { it is ConcurrentStrategyWithTag && it.tag == tag } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment