开发者社区> 问答> 正文

java rmi 时间过长没返回值

编写的服务端在linux系统下运行,当服务端运行时间超过10分钟,那么客户端就不能获取服务端运行结束的结果,
客户端一直挂起,而如果服务端运行时间在10分钟内,那么客户端可以接收到服务端运行的结果。各位大神,这个问题怎么解决啊?急!!!

服务端代码部分: public static void main(String[] args) {
GetProperties gp = new GetProperties();
String url = gp.getValue("url");
String post = gp.getValue("post");
try {
LocateRegistry.createRegistry(Integer.parseInt(post));
FileChangeAndLoad fs = new FileChangeAndLoadImpl();
Naming.rebind(url, fs);
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}

客户端代码部分:

try {
FileChangeAndLoad fcal =(FileChangeAndLoad)Naming.lookup( new GetProperties().getValue("url"));
String str = fcal.getFile();
System.out.println(str);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (NotBoundException e) {
e.printStackTrace();
}

展开
收起
杨冬芳 2016-07-18 11:01:32 1950 0
1 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载