forked from srieger/verteilte-systeme-bsc-ai-examples
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
package verteiltesysteme.rmi;
|
|
|
|
import java.rmi.RemoteException;
|
|
import java.rmi.registry.LocateRegistry;
|
|
import java.rmi.registry.Registry;
|
|
import java.rmi.server.UnicastRemoteObject;
|
|
|
|
public class RMIEchoServer implements RMIEchoInterface {
|
|
public RMIEchoServer() {}
|
|
|
|
public static void main(String args[]) {
|
|
|
|
try {
|
|
RMIEchoServer obj = new RMIEchoServer();
|
|
RMIEchoInterface stub = (RMIEchoInterface) UnicastRemoteObject.exportObject(obj, 0);
|
|
|
|
// Bind the remote object's stub in the registry
|
|
Registry registry = LocateRegistry.getRegistry();
|
|
registry.bind("RMIEchoInterface", stub);
|
|
|
|
System.err.println("Server ready");
|
|
} catch (Exception e) {
|
|
System.err.println("Server exception: " + e.toString());
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public String toLowerCase(String input) throws RemoteException {
|
|
return input.toLowerCase();
|
|
}
|
|
|
|
@Override
|
|
public String toUpperCase(String input) throws RemoteException {
|
|
return input.toUpperCase();
|
|
}
|
|
}
|