Last active
October 31, 2019 00:21
-
-
Save pencelab/53d31e222e13ec2c58ea3508a867ac1f 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
runBlocking { | |
val defIsEven = operator.sumIsEvenAsync() | |
val defAverage = operator.sumAverageAsync() | |
val defSquare = operator.sumSquareAsync() | |
launch { | |
try { | |
log("${Operator.OPERATION_IS_EVEN} Result = ${defIsEven.await()}") | |
} catch (e: Exception) { | |
log("${Operator.OPERATION_IS_EVEN} Caught: [ $e ]") | |
} finally { | |
log("--- NOTHING CONTAINING \"${Operator.OPERATION_IS_EVEN}\" SHOULD APPEAR AFTER THIS LINE ---") | |
delay(3000) | |
} | |
} | |
launch { | |
try { | |
log("${Operator.OPERATION_AVERAGE} Result = ${defAverage.await()}") | |
} catch (e: Exception) { | |
log("${Operator.OPERATION_AVERAGE} Caught: [ $e ]") | |
} finally { | |
log("--- NOTHING CONTAINING \"${Operator.OPERATION_AVERAGE}\" SHOULD APPEAR AFTER THIS LINE ---") | |
delay(3000) | |
} | |
} | |
launch { | |
try { | |
log("${Operator.OPERATION_SQUARE} Result = ${defSquare.await()}") | |
} catch (e: Exception) { | |
log("${Operator.OPERATION_SQUARE} Caught: [ $e ]") | |
} finally { | |
log("--- NOTHING CONTAINING \"${Operator.OPERATION_SQUARE}\" SHOULD APPEAR AFTER THIS LINE ---") | |
delay(3000) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment