如何解决动态注册Java RMI的类
Optional<Comparable> executeRemotely(CustomAction action)
throws NotBoundException,remoteexception {
// {...}
}
客户端实现了CustomAction
:
public class Incrementor {
public Integer complexIncrementor(Integer source){
// {...}
}
}
public class IncrementValueAction implements CustomAction {
Integer incrementValue;
public IncrementValueAction(Integer incrementValue) {
this.incrementValue = incrementValue;
}
@Override
public void execute(Entity entity) {
Integer count = entity.getProperty("count");
entity.setProperty("count",new Incrementor().complexIncrementor(count);
}
}
但类本身未在RMI的服务器端定义。
呼叫RMI服务器
remoteClient.executeRemotely(new IncrementLikesAction(1000));
如何动态地注册使用的Incrementor
类,以便服务器端在执行CustomAction
时可以使用该类?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。