-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessoServer.java
More file actions
executable file
·33 lines (26 loc) · 966 Bytes
/
ProcessoServer.java
File metadata and controls
executable file
·33 lines (26 loc) · 966 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
30
31
32
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry ;
import java.rmi.RemoteException;
import java.rmi.AlreadyBoundException;
import java.rmi.server.UnicastRemoteObject;
import java.io.IOException;
public class ProcessoServer {
public ProcessoServer(String host) {
try{
ProcessoRemoto stub = new ProcessoImp();
Registry registry = LocateRegistry.createRegistry(1099);
//Dá um nome pra ele no registro
registry.bind ("ProcessoService"+host, stub);
System.out.println ("Servidor iniciado ...");
}catch(RemoteException Re){
System.out.println(Re.getMessage());
}catch(AlreadyBoundException ABe){
System.out.println(ABe.getMessage());
}catch(IOException IOe){
System.out.println(IOe.getMessage());
}
}
public static void main(String[] args) {
new ProcessoServer(args[0]);
}
}