rmi test hello world

This commit is contained in:
2014-11-16 18:35:27 +01:00
parent b2d75ffed6
commit bc03a1f378
5 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package rmi_hello_world;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
/**
* Created by Giovanni on 09/11/2014.
*/
public class HelloWorldImpl extends UnicastRemoteObject implements HelloWorldInterface {
private static final long serialVersionUID = 5184834L;
public HelloWorldImpl()throws RemoteException {
}
@Override
public String stampa(String in) throws RemoteException {
System.out.print(in);
return in;
}
}

View File

@@ -0,0 +1,14 @@
package rmi_hello_world;
import java.rmi.Remote;
import java.rmi.RemoteException;
/**
* Created by Giovanni on 09/11/2014.
*/
public interface HelloWorldInterface extends Remote {
String stampa (String in) throws RemoteException;
}

View File

@@ -0,0 +1,39 @@
package rmi_hello_world;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.logging.Logger;
/**
* Created by Giovanni on 09/11/2014.
*/
public class Launch {
public static void main (String[] arg){
Logger l =Logger.getLogger("hellowordlogger");
System.setSecurityManager(new RMISecurityManager());
try {
Registry registry = LocateRegistry.createRegistry(10000);
HelloWorldImpl obj = new HelloWorldImpl();
l.info("Creato oggetto");
registry.bind("HW",obj);
l.info("Oggetto registrato");
}
catch (Exception e){
e.printStackTrace();
}
}
}

BIN
rmi_hello_world/jli.dll Normal file

Binary file not shown.

Binary file not shown.