rmi

rmi vs servlets vs sockets

点点圈 提交于 2019-11-29 01:05:00
问题 what is the difference between socket programming, rmi and Servlets. When to use what? 回答1: The Socket APIs are the low-level (transport level) abstraction by which a Java application interacts with the network, and by extension with remote clients and services. Socket and related APIs support reliable byte stream and unreliable messaging services. They are typically used for TCP/IP and UDP/IP, though other networking protocol stacks can (at least in theory) be supported. RMI is a framework

Is it possible to use RMI bidirectional between two classes?

淺唱寂寞╮ 提交于 2019-11-28 23:33:22
I want to share some information between two classes (A and B), which are running in different java programs. Instead of writing a whole communication protocol I want to use the java build-in rmi classes for that purpose. Currently class B is able to run a method which belongs to class A remotely. Is it somehow possible to use the same "connection" within class A to call a method of class B? Otherwise I probably have to implement a second rmi service ... BR, Markus If B implements Remote , it can be export and passed as a parameter in an RMI call to A . In this scenario, there's no need to

Most Efficient - Performance wise - for inter JVM communication

拟墨画扇 提交于 2019-11-28 23:20:24
问题 I have a Java application that require communication between different process. Process could run in same JVM or different JVM, but runs on the same machine. My application need to submit "messages" to another process (same or different JVM) and forgot about it. similar to messaging queue like IBM "MQ", but simple, and only use memory, no IO to hard disk for performance gains. I'm not sure what is the best approach from Performance prescriptive. I wonder if RMI is efficient in terms of

手写实现RMI框架

久未见 提交于 2019-11-28 22:46:57
1.Java RMI RMI(Remote Method Invocation)远程方法调用,其目的是让客户端可以像调用本地对象方法那样调用服务端java对象 原理如图所示: 具体的实现步骤: 1、客户调用客户端辅助对象stub上的方法 2、客户端辅助对象stub打包调用信息(变量、方法名),通过网络发送给服务端辅助对象skeleton 3、服务端辅助对象skeleton将客户端辅助对象发送来的信息解包,找出真正被调用的方法以及该方法所在对象 4、调用真正服务对象上的真正方法,并将结果返回给服务端辅助对象skeleton 5、服务端辅助对象将结果打包,发送给客户端辅助对象stub 6、客户端辅助对象将返回值解包,返回给调用者 7、客户获得返回值 这里有几个技术关键点: (1)客户端和服务端之间是如何传输信息的?传输的信息是什么? 传输信息的渠道是socket流,传输的信息是客户端想要调用服务端的类,方法,参数的序列化数据 (2)服务端接收到客户端的信息之后是如何找到客户端想要调用的方法的? 服务端接收到传递过来的数据之后,根据指定的类,方法,参数反射调用对应的方法,然后将方法的返回结果写入socket流 (3)客户端是如何把想要调用服务端的类,方法,参数等数据进行序列化的? 客户端使用的是动态代理技术,这样既可以避免想要调用的类没有实现类而报错,又可以在调用对应的方法的时候

Java RMI and Thread Synchronization questions

≡放荡痞女 提交于 2019-11-28 19:56:41
I actually have two questions about Java RMI and thread synchronization: 1) If I implement my RMI remote methods as synchronized, are they guaranteed to be mutually exclusive? I need to make sure that no two of my RMI methods (methods offered to clients) execute at the same time. 2) I have a method that the server executes periodically. It is used to do cleanups. I have to make sure that this particular method does not execute when there is any RMI method being run/used by remote clients. Also, when that method is running, RMI calls shouldn't be possible. I.e. Clients must wait. Any idea how I

Communication between local JVMs

拈花ヽ惹草 提交于 2019-11-28 17:54:09
My question: What approach could/should I take to communicate between two or more JVM instances that are running locally? Some description of the problem: I am developing a system for a project that requires separate JVM instances to isolate certain tasks from each other entirely. In it's running, the 'parent' JVM will create 'child' JVMs that it will expect to execute and then return results to it (in the format of relatively simple POJO classes, or perhaps structured XML data). These results should not be transferred using the SysErr/SysOut/SysIn pipes as the child may already use these as

RMI vs. Web Services. What's best for Java2Java remoting?

拜拜、爱过 提交于 2019-11-28 15:48:45
问题 I'm new to both Web Services and RMI and I wonder which is the better way to do remoting between different web applications, when these applications are all written in Java, that is when different programming languages don't matter (which would be the advantage of WS). While on the one hand I would guess that there's a performance overhead when using web services (does anyone have some numbers to prove that?), on the other hand it seems to me that web services are much more loosely coupled

What is the difference between Java RMI and RPC?

本小妞迷上赌 提交于 2019-11-28 15:02:51
What is the actual difference between Java RMI and RPC? I have read in some places that RMI uses Objects? fortran RPC is C based, and as such it has structured programming semantics, on the other side, RMI is a Java based technology and it's object oriented. With RPC you can just call remote functions exported into a server, in RMI you can have references to remote objects and invoke their methods, and also pass and return more remote object references that can be distributed among many JVM instances, so it's much more powerful. RMI stands out when the need to develop something more complex

configuring RMI host so that it should know which client port is accessing it

末鹿安然 提交于 2019-11-28 14:28:29
I have been working on spring RMI and I have set up a host and one client. Below is the code of my host. I want to modify it in such a way that host should know which client is accessing it, so in other words server should know which client port is accessing it. How can I achieve this in Spring RMI? interface :- package com.javatpoint; public interface Calculation { int cube(int number); } class :- package com.javatpoint; public class CalculationImpl implements Calculation{ @Override public int cube(int number) { return number*number*number; } } and finally the host configuration xml <?xml

java.net.MalformedURLException: unknown protocol: rsrc

江枫思渺然 提交于 2019-11-28 13:43:52
I get this; java.net.MalformedURLException: unknown protocol: rsrc I'm not entirely sure what to do about this unknown protocol. I am using simple RMI to communicate between two JVMs. Is it a jar that I am missing that contains this protocol and, if so, which one? I haven't found Google searches to be all that great for this issue. Any help would be appreciated. Thanks. EDIT2: To clarify, my RMI code works when running from Eclipse. It's when I export and use runnable jar files and such that it breaks. EDIT: Here's a code snippet: registry=LocateRegistry.getRegistry( rmiServerAddress, (new