rmi test hello world
This commit is contained in:
22
rmi_hello_world/HelloWorldImpl.java
Normal file
22
rmi_hello_world/HelloWorldImpl.java
Normal 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;
|
||||
}
|
||||
}
|
||||
14
rmi_hello_world/HelloWorldInterface.java
Normal file
14
rmi_hello_world/HelloWorldInterface.java
Normal 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;
|
||||
|
||||
}
|
||||
39
rmi_hello_world/Launch.java
Normal file
39
rmi_hello_world/Launch.java
Normal 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
BIN
rmi_hello_world/jli.dll
Normal file
Binary file not shown.
BIN
rmi_hello_world/rmiregistry.exe
Normal file
BIN
rmi_hello_world/rmiregistry.exe
Normal file
Binary file not shown.
Reference in New Issue
Block a user