-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputeEngineServer.java
More file actions
29 lines (26 loc) · 921 Bytes
/
ComputeEngineServer.java
File metadata and controls
29 lines (26 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.rmi.*;
import java.net.*;
import java.rmi.registry.LocateRegistry;
/*
* Questa è l'implemntazione del server.
*/
public class ComputeEngineServer {
public static void main(String[] args) {
try {
// Viene istanziato un oggetto di tipo ComputeEngine
ComputeEngine comp = new ComputeEngineImpl();
// Viene avviato il registro
LocateRegistry.createRegistry(1099);
// Viene memorizzatto l'oggetto sulla tabella del registro con il nome di compute
Naming.bind("rmi://127.0.0.1/compute", comp);
} catch (AccessException e) {
System.err.println("Bind operation not permitted");
} catch (MalformedURLException e) {
System.err.println("Wrong URL for binding");
} catch (AlreadyBoundException e) {
System.err.println("Object already bound to the registry");
} catch (RemoteException e) {
System.err.println("Remote invocation error");
}
}
}