rmi

Passing remote parameters in RMI

北战南征 提交于 2019-12-24 08:56:50
问题 I would like to have confirm about RMI theory. Let us suppose that Client A requests a remote reference of an object O to a Server B. Well, now if In O interface (Interf) there is a method like: void foo(Interf obj); When Client A calls O.foo(O) it passes stub reference (before received ) and then Server does not use its local reference but the Stub Object (received by Client), and so each call on O methods by Server will make use of its TCP/IP service. Is it Ok? You should feel free to add

Java RMI: How can I restrict RMI method to only be called internally by the client object

左心房为你撑大大i 提交于 2019-12-24 07:29:35
问题 I have an RMI model which uses a thread on each side (Client/Server Side) to maintain a client heartbeat. If the client crashes without unlocking the server, the lock will eventually timeout. I don't want the user of my client API to be able to call the methods that deal with the heartbeat/lock. However from my understanding of Java RMI, the client and server must implement a common interface which defines all the methods that I want RMI access to, and these methods must be public. Since the

Java RMI: How can I restrict RMI method to only be called internally by the client object

旧街凉风 提交于 2019-12-24 07:29:09
问题 I have an RMI model which uses a thread on each side (Client/Server Side) to maintain a client heartbeat. If the client crashes without unlocking the server, the lock will eventually timeout. I don't want the user of my client API to be able to call the methods that deal with the heartbeat/lock. However from my understanding of Java RMI, the client and server must implement a common interface which defines all the methods that I want RMI access to, and these methods must be public. Since the

Java RMI 概观

前提是你 提交于 2019-12-24 07:14:50
终于……看到了……代理模式…… 我觉得…… 这个模式…… 真的…… 好难啊…… 首先是远程代理 Java RMI 概观 ↑都是这个东西好难 代理模式:为另一个对象提供一个替身或占位符以控制对这个对象的访问。 使用代理模式创建代表(representative)对象,让代表对象控制某对象的访问,被代理的对象可以是远程的对象,创建开销大的对象或者需要安全控制的对象 类图: RealSubject是真正做事的对象,它是被Proxy代理和控制访问的对象。客户与RealSubject的交互都必须通过Proxy。 远程代理: 远程代理可以作为;另一个JVM上的对象的本地代表。调用代理方法,会代理利用网络转发到远程执行,并将结果通过网络返回给代理,再由代理将结果转给客户。 虚拟代理: 虚拟代理作为创建开销大的对象的代表。虚拟代理经常直到我们真正需要一个对象的时候才创建它。当对象在创建前和创建中时,由虚拟代理来扮演对象的替身。对象创建后,代理就会将请求直接委托给对象。 栗子: 写一个程序展示CD封面,当封面没有加载好的时候,就显示“加载中。。。” 创建一个代理类,当照片没有加载好的时候,就显示加载中,但加载好之后,就好所有方法委托给真正的照片类。 为什么要虚拟代理呢?因为没加载好的时候,还没有图片,这个代理就是一个虚拟的图片,,, import java.awt.Component; import

Java RMI - Socket Permission issues

北城余情 提交于 2019-12-24 05:38:26
问题 I'm having problems trying to connect my java program to 2 different sockets. Basically I want to initialise my RMI Server (connecting to port 1099) and then also initialise PrologBeans on port 10002. The initialisation seems to work fine for both, but as soon as I try to access the prologBeans I get the following error: Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:10002 connect,resolve) at java.security

Passing object reference using RMI

大憨熊 提交于 2019-12-24 05:21:39
问题 Hello everyone, I have been banging my head really hard trying to solve this problem. I really appreciate if anyone can please have a look at my problem and help me. I have multiple clients that uses Java RMI to establish a connection (register()) and receive a list of connects clients from the server (get()). My goal is to get clients to talk to each other using RMI, without having to register themselves, only the server so far is being register. I am trying to pass a reference of the client

How to specify @Throws for a property in interface

一笑奈何 提交于 2019-12-24 05:01:34
问题 I am currently porting some Java RMI code to Kotlin. The legacy interface in Java is: interface Foo: Remote { Bar getBar() throws RemoteException } After running the auto-migration tool, the field bar is changed into a property: interface Foo: Remote { val bar: Bar } However, in the migrated program, getBar is no longer marked as throws RemoteException , which causes illegal remote method encountered error in a RMI call. I was wondering is there any way to mark @Throws for a property? 回答1:

How to specify @Throws for a property in interface

坚强是说给别人听的谎言 提交于 2019-12-24 05:01:03
问题 I am currently porting some Java RMI code to Kotlin. The legacy interface in Java is: interface Foo: Remote { Bar getBar() throws RemoteException } After running the auto-migration tool, the field bar is changed into a property: interface Foo: Remote { val bar: Bar } However, in the migrated program, getBar is no longer marked as throws RemoteException , which causes illegal remote method encountered error in a RMI call. I was wondering is there any way to mark @Throws for a property? 回答1:

LocateRegistry.createRegistry

筅森魡賤 提交于 2019-12-24 02:28:08
问题 I need an RMI registry that makes the service accessible from outside my machine, while still being able to refuse a connection based on the IP of the client. The following code makes the registry only accessible from my machine, but never gets into the "RMIClientSocketFactory" code: LocateRegistry.createRegistry(uri.getPort(), new RMIClientSocketFactory() { @Override public Socket createSocket(String host, int port) throws IOException { System.out.println("RMIServerSocketFactory()

Java RMI ClassNotFoundException on the client side

百般思念 提交于 2019-12-24 01:43:12
问题 There have been several questions with this same Title, but none of them have helped me solve my issue. I have been trying to follow the tutorial here: https://docs.oracle.com/javase/tutorial/rmi/overview.html I was driving myself crazy by putting everything in one project, so I've created 3 separate projects: Server -> It has Main (Driver), and class:ServerNode implements Compute Client -> It has Main (Driver), and class:TestTask implements Task Shared -> It has interface:Task, and interface