Added comments. Fixed onErrorGlobal (it is now a separate name, since the function signatures had issues), made it a unit function instead of method, so it can be passed around
This commit is contained in:
parent
7908ef2593
commit
a4a3057f39
|
@ -127,7 +127,7 @@ internal constructor(val type: Class<*>,
|
||||||
|
|
||||||
init {
|
init {
|
||||||
require(!config.previouslyUsed) { "${type.simpleName} configuration cannot be reused!" }
|
require(!config.previouslyUsed) { "${type.simpleName} configuration cannot be reused!" }
|
||||||
config.validate()
|
config.validate() // this happens more than once! (this is ok)
|
||||||
|
|
||||||
// serialization stuff
|
// serialization stuff
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
@ -147,7 +147,7 @@ internal constructor(val type: Class<*>,
|
||||||
|
|
||||||
// Only starts the media driver if we are NOT already running!
|
// Only starts the media driver if we are NOT already running!
|
||||||
try {
|
try {
|
||||||
aeronDriver = AeronDriver(config, type, logger)
|
aeronDriver = AeronDriver(config, type, logger, listenerManager.notifyError)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.error("Error initialize endpoint", e)
|
logger.error("Error initialize endpoint", e)
|
||||||
throw e
|
throw e
|
||||||
|
@ -281,11 +281,11 @@ internal constructor(val type: Class<*>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when there is an error in general
|
* Called when there is a global error (and error that is not specific to a connection)
|
||||||
*
|
*
|
||||||
* The error is also sent to an error log before this method is called.
|
* The error is also sent to an error log before this method is called.
|
||||||
*/
|
*/
|
||||||
fun onError(function: Throwable.() -> Unit) {
|
fun onErrorGlobal(function: (Throwable) -> Unit) {
|
||||||
actionDispatch.launch {
|
actionDispatch.launch {
|
||||||
listenerManager.onError(function)
|
listenerManager.onError(function)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user