Fixed math for rmiID storage. made ASYNC rmi call ID a constant
This commit is contained in:
parent
698701dfdc
commit
779861b072
|
@ -63,6 +63,7 @@ class RemoteObjectStorage(val logger: KLogger) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val INVALID_RMI = 0
|
const val INVALID_RMI = 0
|
||||||
|
const val ASYNC_RMI = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is the ID -> Object RMI map. The RMI ID is used (not the kryo ID)
|
// this is the ID -> Object RMI map. The RMI ID is used (not the kryo ID)
|
||||||
|
|
|
@ -311,7 +311,7 @@ internal class RmiMessageManager(logger: KLogger,
|
||||||
val rmiId = RmiUtils.unpackUnsignedRight(message.packedId)
|
val rmiId = RmiUtils.unpackUnsignedRight(message.packedId)
|
||||||
val cachedMethod = message.cachedMethod
|
val cachedMethod = message.cachedMethod
|
||||||
val args = message.args
|
val args = message.args
|
||||||
val sendResponse = rmiId != 1 // async is always with a '1', and we should NOT send a message back if it is '1'
|
val sendResponse = rmiId != RemoteObjectStorage.ASYNC_RMI // async is always with a '1', and we should NOT send a message back if it is '1'
|
||||||
|
|
||||||
logger.trace { "RMI received: $rmiId" }
|
logger.trace { "RMI received: $rmiId" }
|
||||||
|
|
||||||
|
|
|
@ -33,15 +33,17 @@ import kotlin.concurrent.write
|
||||||
internal class RmiResponseManager(private val logger: KLogger, private val actionDispatch: CoroutineScope) {
|
internal class RmiResponseManager(private val logger: KLogger, private val actionDispatch: CoroutineScope) {
|
||||||
companion object {
|
companion object {
|
||||||
val TIMEOUT_EXCEPTION = Exception()
|
val TIMEOUT_EXCEPTION = Exception()
|
||||||
val ASYNC_WAITER = RmiWaiter(1) // this is never waited on, we just need this to optimize how we assigned waiters.
|
val ASYNC_WAITER = RmiWaiter(RemoteObjectStorage.ASYNC_RMI) // this is never waited on, we just need this to optimize how we assigned waiters.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Response ID's are for ALL in-flight RMI on the network stack. instead of limited to (originally) 64, we are now limited to 65,535
|
// Response ID's are for ALL in-flight RMI on the network stack. instead of limited to (originally) 64, we are now limited to 65,535
|
||||||
// these are just looped around in a ring buffer.
|
// these are just looped around in a ring buffer.
|
||||||
// These are stored here as int, however these are REALLY shorts and are int-packed when transferring data on the wire
|
// These are stored here as int, however these are REALLY shorts and are int-packed when transferring data on the wire
|
||||||
// 64,000 IN FLIGHT RMI method invocations is plenty
|
// 65535 IN FLIGHT RMI method invocations is plenty
|
||||||
private val maxValuesInCache = 65535 - 2 // -2 because '0' and '1' are reserved
|
// 0 is reserved for INVALID
|
||||||
|
// 1 is reserved for ASYNC
|
||||||
|
private val maxValuesInCache = 65535
|
||||||
private val rmiWaiterCache = Channel<RmiWaiter>(maxValuesInCache)
|
private val rmiWaiterCache = Channel<RmiWaiter>(maxValuesInCache)
|
||||||
|
|
||||||
private val pendingLock = ReentrantReadWriteLock()
|
private val pendingLock = ReentrantReadWriteLock()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user