How to make an RMI server multi-client program without registerting clients

I have a RMI server which a number of clients connect to. When a client registers a change, the server reacts and instructs all clients to make a change.

I have been looking into a number of hello world RMI examples, but none of them addresses how to persist a connection back to the client from the server.

What i would like to achieve is something along these lines: Server is registered on the rmiregistry. Client 1 connects to the server and calls a method on the server. Client 2 connects to the server and calls a method on the server. The server sends the change from client2 to client1.

Java rmi example program with code - SlideShare
15 Mar 2013 ... Steps to run this programs: First of all put these four programs insidebin folder of
JDK. As an example suppose our JDK folder isinside java ...

How does one achieve this without registering every client as a server?

EDIT: After looking at a couple of excellent ansvers (flatter flatter) i am running into the following exception java.rmi.StubNotFoundException: Stub class not found: thegame.connectivity.GameClient_Stub; nested exception is:

java.lang.ClassNotFoundException: thegame.connectivity.GameClient_Stub at sun.rmi.server.Util.createStub( at sun.rmi.server.Util.createProxy( at sun.rmi.server.UnicastServerRef.exportObject( at java.rmi.server.UnicastRemoteObject.exportObject( at java.rmi.server.UnicastRemoteObject.exportObject( at thegame.connectivity.GameClient.bind( at at thegame.connectivity.GameClient.main( Caused by: java.lang.ClassNotFoundException: thegame.connectivity.GameClient_Stub at$ at$ at Method) at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at java.lang.Class.forName0(Native Method) at java.lang.Class.forName( at sun.rmi.server.Util.createStub( ... 7 more

On this class

public class GameClient extends Thread implements Remote, Client, ModelChangeListener<Client>{ private static final long serialVersionUID = -394039736555035873L; protected Queue<GameModelEvent> queue = new ConcurrentLinkedQueue<GameModelEvent>(); public GameClient(){ } public static void main(String[] args){ GameClient client = new GameClient();; } protected void bind(){ System.setProperty("java.rmi.server.codebase","file:bin/"); try { Registry registry = LocateRegistry.getRegistry(); Client c = (Client)UnicastRemoteObject.exportObject(this); Server stub = (Server) registry.lookup("Server"); stub.registerClient(c); } catch (RemoteException | NotBoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void run() {; bind(); while(!Thread.interrupted()){ System.out.print("."); GameModelEvent event = queue.poll(); while(event != null){ System.out.println(event); event = queue.poll(); } try { Thread.sleep(100); } catch (InterruptedException e) { return; } } } ...

It works well when i comment out the UnicatRemoteObject and just pass null as a parameter. So there is a connection and everything is running. But no stub... Commenting out the codebase has no effect either. The codebase works fine on the server.

Creating a Client Program (The Java™ Tutorials > RMI)
This RMI Java tutorial describes the Java RMI system. It walks ... Two separate
classes make up the client in our example. ... Finally, the program prints the result

Any ideas on what is wrong?

How To Make bootable pendrive In windows 7 without any software
We all use CD/DVDs to install new windows. But this is a time of notebooks and Net books most of them are not having the CD/DVD drivers because they want them to make them more and more compact.
How To Make
Because birds of a feather really do flock together. I have always been a very positive, outgoing woman but I've lived most of my life without positive female friendships. So, I decided to make a concerted effort to cultivate friendships with healthy, inspiring, communicative women, and here's what I have learned: 1.
How To Curl Hair Without Heat
What You Will Need A large amount of bobby pins, especially if you have really thick hair. An estimated amount of 20-30 bobby pins should be enough for all hair types. A comb and brush to de-tangle hair.