java.rmi


1. Remote Object Invocation (RMI) with Simple Data Types

import java.rmi.Remote;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

// Define the remote interface.
interface RemoteInterface {
    int add(int a, int b);
}

// Implement the remote object.
class RemoteObject implements RemoteInterface {
    @Override
    public int add(int a, int b) {
        return a + b;
    }
}

// Create the remote object and register it with the RMI registry.
RemoteInterface remoteObject = new RemoteObject();
Registry registry = LocateRegistry.createRegistry(1099);
registry.bind("RemoteObject", remoteObject);

// Get the remote object from the RMI registry and invoke its method.
RemoteInterface stub = (RemoteInterface) registry.lookup("RemoteObject");
int result = stub.add(5, 7);
System.out.println(result); // Output: 12

2. RMI with Custom Data Types

3. RMI with Method Overloading

4. RMI with Exception Handling

5. RMI with Security Manager

6. RMI with Client Callback

7. RMI with Activation

8. RMI with Live Refreshable Classes

9. RMI with JNDI Lookup

10. RMI with Remote Event Handling

11. RMI with Serialization

12. RMI with HTTP Tunneling

13. RMI with JRMP Protocol