Better toString() methods for the unique ID of the client/server
This commit is contained in:
parent
e403e1d6e1
commit
6220ec617b
@ -205,6 +205,10 @@ open class Client<CONNECTION : Connection>(
|
||||
@Volatile
|
||||
private var connection0: CONNECTION? = null
|
||||
|
||||
private val string0: String by lazy {
|
||||
"EndPoint [Client: $${storage.publicKey!!.toHexString()}]"
|
||||
}
|
||||
|
||||
final override fun newException(message: String, cause: Throwable?): Throwable {
|
||||
// +2 because we do not want to see the stack for the abstract `newException`
|
||||
val clientException = ClientException(message, cause)
|
||||
@ -907,7 +911,7 @@ open class Client<CONNECTION : Connection>(
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "EndPoint [Client: $${storage.publicKey!!.toHexString()}]"
|
||||
return string0
|
||||
}
|
||||
|
||||
fun <R> use(block: (Client<CONNECTION>) -> R): R {
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package dorkbox.network
|
||||
|
||||
import dorkbox.bytes.toHexString
|
||||
import dorkbox.network.aeron.AeronDriver
|
||||
import dorkbox.network.aeron.AeronPoller
|
||||
import dorkbox.network.aeron.EventPoller
|
||||
@ -180,6 +181,10 @@ open class Server<CONNECTION : Connection>(
|
||||
var port: Int = 0
|
||||
private set
|
||||
|
||||
private val string0: String by lazy {
|
||||
"EndPoint [Server: $${storage.publicKey!!.toHexString()}]"
|
||||
}
|
||||
|
||||
final override fun newException(message: String, cause: Throwable?): Throwable {
|
||||
// +2 because we do not want to see the stack for the abstract `newException`
|
||||
val serverException = ServerException(message, cause)
|
||||
@ -392,7 +397,7 @@ open class Server<CONNECTION : Connection>(
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "EndPoint [Server]"
|
||||
return string0
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,10 +74,8 @@ internal class RmiClient(val isGlobal: Boolean,
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private val EMPTY_ARRAY: Array<Any> = Collections.EMPTY_LIST.toTypedArray() as Array<Any>
|
||||
|
||||
private val safeAsyncState = object: ThreadLocal<Boolean?>() {
|
||||
override fun initialValue(): Boolean? {
|
||||
return null
|
||||
}
|
||||
private val safeAsyncState: ThreadLocal<Boolean?> = ThreadLocal.withInitial {
|
||||
null
|
||||
}
|
||||
|
||||
private const val charPrim = 0.toChar()
|
||||
|
Loading…
Reference in New Issue
Block a user