轻量级EJB--Cajo
Cajo的目的就是使得JVM间的通信变得简单,不需要EJB容器,任何servlet容器之间都可以进行通信。先到官方网站http://java.net/projects/cajo/downloads 下载相应的包,就一个包下载完就可以直接用了。只需要用到gnu.cajo.invoke.Remote和gnu.cajo.utils.ItemServer两个类就可以了,如下:Remote.config(n
·
Cajo的目的就是使得JVM间的通信变得简单,不需要EJB容器,任何servlet容器之间都可以进行通信。先到官方网站http://java.net/projects/cajo/downloads 下载相应的包,就一个包下载完就可以直接用了。
只需要用到gnu.cajo.invoke.Remote和gnu.cajo.utils.ItemServer两个类就可以了,如下:
Remote.config(null, port, null, 0);
ItemServer.bind(new CajoTestObj(), "displayMethodName");
如果另一台JVM需要读取相关信息的话可以这样:
Object object = Remote.getItem("//host:port/displayMethodName");
Map<Integer, User> userArray= (Map<Integer, User>)Remote.invoke(object, "realMethodName",null);
就这么简单就读取到了另外一台JVM上的数据。
更多推荐
已为社区贡献1条内容
所有评论(0)