[英]How does JVM handle runtime exception in RMI remote method?
I have been trying to find out how JVM handles runtime exception in RMI remote methods. 我一直试图找出JVM如何在RMI远程方法中处理运行时异常。 I have a remote method that contains the following two methods:
我有一个远程方法,其中包含以下两种方法:
doSomething(
print "doSomething thread id " + Thread.currentThread.getId()
)
fail(){
print "fail thread id " + Thread.currentThread.getId()
throw new RunTimeException
}
The behavior I saw was that even if method fail() is invoked, the thread on which the runtime exception was thrown is still not terminated. 我看到的行为是,即使调用了方法fail(),引发运行时异常的线程仍不会终止。 A sample output is:
示例输出为:
fail thread id 16
stacktrace
...
doSomething thread id 16
doSomething thread id 16
The exception is caught. 捕获到异常。 The caller will get a ServerException with your RuntimeException nested in it as the cause.
调用者将获得一个ServerException,其中带有您的RuntimeException嵌套在其中。 The executing thread doesn't die.
执行线程不会死。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.