Removed RemoteObject.close()

This commit is contained in:
Robinson 2021-04-30 18:21:01 +02:00
parent 0b95a4503d
commit 4507cf9f87
3 changed files with 8 additions and 18 deletions

View File

@ -81,9 +81,4 @@ interface RemoteObject {
* instead of invoking the remote `equals()` method on the object.
*/
fun enableEquals(enabled: Boolean)
/**
* Causes this RemoteObject to stop listening to the connection for method invocation response messages.
*/
fun close()
}

View File

@ -22,11 +22,7 @@ import kotlinx.coroutines.runBlocking
import java.lang.reflect.InvocationHandler
import java.lang.reflect.Method
import java.util.*
import kotlin.coroutines.Continuation
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.*
object MyUnconfined : CoroutineDispatcher() {
override fun isDispatchNeeded(context: CoroutineContext): Boolean = false
@ -56,7 +52,6 @@ internal class RmiClient(val isGlobal: Boolean,
companion object {
private val methods = RmiUtils.getMethods(RemoteObject::class.java)
private val closeMethod = methods.find { it.name == "close" }
private val toStringMethod = methods.find { it.name == "toString" }
private val hashCodeMethod = methods.find { it.name == "hashCode" }
private val equalsMethod = methods.find { it.name == "equals" }
@ -75,7 +70,7 @@ internal class RmiClient(val isGlobal: Boolean,
private val EMPTY_ARRAY: Array<Any> = Collections.EMPTY_LIST.toTypedArray() as Array<Any>
}
private var timeoutMillis: Long = 3000
private var timeoutMillis: Long = 3_000L
private var isAsync = false
private var enableToString = false
@ -152,11 +147,6 @@ internal class RmiClient(val isGlobal: Boolean,
if (method.declaringClass == RemoteObject::class.java) {
// manage all of the RemoteObject proxy methods
when (method) {
closeMethod -> {
connection.rmiConnectionSupport.removeProxyObject(rmiObjectId)
return null
}
setResponseTimeoutMethod -> {
timeoutMillis = (args!![0] as Int).toLong()
require(timeoutMillis >= 0) { "ResponseTimeout must be >= 0"}
@ -209,7 +199,6 @@ internal class RmiClient(val isGlobal: Boolean,
}
// setup the RMI request
val invokeMethod = MethodRequest()
// if this is a kotlin suspend function, the continuation arg will NOT be here (it's replaced at runtime)!

View File

@ -70,6 +70,12 @@ internal class RmiManagerConnections<CONNECTION: Connection>(logger: KLogger,
return proxyObject as Iface
}
/**
* on the "client" to remove a connection-specific remote object (that exists on the server)
*/
fun <Iface> deleteRemoteObject(connection: Connection, rmiId: Int) {
removeProxyObject(rmiId)
}
/**
* on the "client" to create a connection-specific remote object (that exists on the server)