Removed RemoteObject.close()
This commit is contained in:
parent
0b95a4503d
commit
4507cf9f87
|
@ -81,9 +81,4 @@ interface RemoteObject {
|
||||||
* instead of invoking the remote `equals()` method on the object.
|
* instead of invoking the remote `equals()` method on the object.
|
||||||
*/
|
*/
|
||||||
fun enableEquals(enabled: Boolean)
|
fun enableEquals(enabled: Boolean)
|
||||||
|
|
||||||
/**
|
|
||||||
* Causes this RemoteObject to stop listening to the connection for method invocation response messages.
|
|
||||||
*/
|
|
||||||
fun close()
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,7 @@ import kotlinx.coroutines.runBlocking
|
||||||
import java.lang.reflect.InvocationHandler
|
import java.lang.reflect.InvocationHandler
|
||||||
import java.lang.reflect.Method
|
import java.lang.reflect.Method
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.*
|
||||||
import kotlin.coroutines.CoroutineContext
|
|
||||||
import kotlin.coroutines.EmptyCoroutineContext
|
|
||||||
import kotlin.coroutines.resume
|
|
||||||
import kotlin.coroutines.resumeWithException
|
|
||||||
|
|
||||||
object MyUnconfined : CoroutineDispatcher() {
|
object MyUnconfined : CoroutineDispatcher() {
|
||||||
override fun isDispatchNeeded(context: CoroutineContext): Boolean = false
|
override fun isDispatchNeeded(context: CoroutineContext): Boolean = false
|
||||||
|
@ -56,7 +52,6 @@ internal class RmiClient(val isGlobal: Boolean,
|
||||||
companion object {
|
companion object {
|
||||||
private val methods = RmiUtils.getMethods(RemoteObject::class.java)
|
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 toStringMethod = methods.find { it.name == "toString" }
|
||||||
private val hashCodeMethod = methods.find { it.name == "hashCode" }
|
private val hashCodeMethod = methods.find { it.name == "hashCode" }
|
||||||
private val equalsMethod = methods.find { it.name == "equals" }
|
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 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 isAsync = false
|
||||||
|
|
||||||
private var enableToString = false
|
private var enableToString = false
|
||||||
|
@ -152,11 +147,6 @@ internal class RmiClient(val isGlobal: Boolean,
|
||||||
if (method.declaringClass == RemoteObject::class.java) {
|
if (method.declaringClass == RemoteObject::class.java) {
|
||||||
// manage all of the RemoteObject proxy methods
|
// manage all of the RemoteObject proxy methods
|
||||||
when (method) {
|
when (method) {
|
||||||
closeMethod -> {
|
|
||||||
connection.rmiConnectionSupport.removeProxyObject(rmiObjectId)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
setResponseTimeoutMethod -> {
|
setResponseTimeoutMethod -> {
|
||||||
timeoutMillis = (args!![0] as Int).toLong()
|
timeoutMillis = (args!![0] as Int).toLong()
|
||||||
require(timeoutMillis >= 0) { "ResponseTimeout must be >= 0"}
|
require(timeoutMillis >= 0) { "ResponseTimeout must be >= 0"}
|
||||||
|
@ -209,7 +199,6 @@ internal class RmiClient(val isGlobal: Boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup the RMI request
|
// setup the RMI request
|
||||||
|
|
||||||
val invokeMethod = MethodRequest()
|
val invokeMethod = MethodRequest()
|
||||||
|
|
||||||
// if this is a kotlin suspend function, the continuation arg will NOT be here (it's replaced at runtime)!
|
// if this is a kotlin suspend function, the continuation arg will NOT be here (it's replaced at runtime)!
|
||||||
|
|
|
@ -70,6 +70,12 @@ internal class RmiManagerConnections<CONNECTION: Connection>(logger: KLogger,
|
||||||
return proxyObject as Iface
|
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)
|
* on the "client" to create a connection-specific remote object (that exists on the server)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user