rmi

Implications of restricting RMI to one port

心已入冬 提交于 2019-12-09 13:28:14
问题 I'd like to be able to restrict the ports used by my application to some small-as-possible known set. The application uses Java RMI to communicate with a remote server. The registry is exported on port 1099, which is standard. However, it appears that the port used to export the various remote objects is not always consistent, though it does stay the same across multiple connections over a short period of time. My uneducated guess is there is some sort of caching of the server sockets going

Java RMI and ClassNotFoundException

限于喜欢 提交于 2019-12-09 10:05:07
问题 I am just starting to learn how to use RMI, and I have a question. I have the following directory structure: compute.jar client | org\examples\rmi\client |--> ComputePi // client main |--> Pi // implements Task org\examples\rmi\compute |--> Compute // interface |--> Task // interface server | org\examples\rmi\engine |--> ComputeEngine // server main, implements Compute org\examples\rmi\compute |--> Compute // interface |--> Task // interface Here's the main method in the ComputePi class: if

Forging a stack trace in Java

梦想与她 提交于 2019-12-09 05:59:35
问题 When you use RMI in Java the remote stack trace of an exception will be prepended when you receive it, somewhat like this: ERROR Client received error when doing stuff: myapp.FooBarException: bla at server.myMethod() at rmi.callHandler() // and now, on the next line comes the client at rmi.sendCall(); at client.doServerMethod() at Thread.run() How is that kind of stacktrace "forgery" done? What do I want it for (apart from just being iterested)? Well, it would help me if I could do this:

Is it possible to serialize anonymous class without outer class?

放肆的年华 提交于 2019-12-09 04:44:59
问题 I made a small research on web and reviewed related topics on this site, but the answers were contradictory: some people said it is not possible, others said it is possible, but dangerous. The goal is to pass an object of the anonymous class as a parameter of the RMI method. Due to RMI requirements, this class must be serializable. Here's no problem, it is easy to make class Serializable. But we know that instances of inner classes hold a reference to an outer class (and anonymous classes are

RMI multiple clients

匆匆过客 提交于 2019-12-09 03:40:52
问题 Does RMI handles multiple clients by itself? i.e. is it possible to use a server function by multiple clients at the same time? if no, how can I do such a thing? if yes, how it works? does it make a new thread for each call ? if one clients blocks the function what would happen with the next client? etc. 回答1: yes how it works? does it make a new thread for each call? if one clients blocks the function what would happen with the next client? etc. It creates a thread for each client connection.

what make rmi server keep running?

为君一笑 提交于 2019-12-08 15:45:30
问题 I have the following RMI server code: public class ServerProgram { public ServerProgram() { try { LocateRegistry.createRegistry(1097); Calculator c = new CalculatorImpl(); String name = "rmi://host:port/name"; Naming.rebind(name, c); System.out.println("Service is bound......"); } catch (Exception e) { } } public static void main(String[] args) { new ServerProgram(); } } When the above program running, it keeps running to wait for client requests. But what I do not understand is what make

Desktop Sharing in java

岁酱吖の 提交于 2019-12-08 14:46:49
问题 I want to create a very simple RMI code which just share the desktop. I have created my classes and also remote interface.in the Share class ,I have an execute method which will return the image of the client's desktop.but I don't know that how can I get that image ?or how can i store it? please help me,thanks. Share class: class Share implements Task<DesktopPaneUI>,Serializable{ public Share(){ } public DesktopPaneUI execute() { } } Task class: public interface Task<T> { T execute(); } 回答1:

JAVA: RMI Callback -> object already exported

℡╲_俬逩灬. 提交于 2019-12-08 12:33:10
问题 this is my first question, so sorry if i'll make it incorrect and for my english. I have to do a distributed-hangman project in java, there are guests, players and masters (more matches). When a user(already registered) log himself or when a master open a match, the server must notifies to all guests (only guests) the event. In the client i had to create 2 stub, 1 for the server, the other one for the graphic interface (swing). The threadpool is for manage the matches, not used now. This is

Spring Async RMI Call

社会主义新天地 提交于 2019-12-08 11:45:12
问题 Is it possible to invoke Java RMI asynchronously? I'd like my RMI call to return immediately and for the server to invoke a callback once a task is completed. I'd currently using RMI support from Spring framework, and i couldn't find any documentation describing it in spring, I suspect I'll need to implement it myself. Please provide examples if possible. Thanks in advance! 回答1: RMI is synchronous and doesn't support callbacks as far as I know. JMS is the Java EE way to make asynch calls. If

Problems updating my JList for active channels

China☆狼群 提交于 2019-12-08 11:35:39
问题 Intro: I've created a chatprogram where a client connects the server. The client is able to join channels, and when they do, the jList(see code) should be updated via DefaultListModel with (getChannel()), and should show all other clients connected to the same channel. I know the getChannel(); works, since ive debugged it(and use systemoutprint). I already have Jlists for active channels and usersonline, which works! :) The clients use callback methods to notify the other clients connected to