-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTHServer.java
More file actions
25 lines (21 loc) · 852 Bytes
/
Copy pathTHServer.java
File metadata and controls
25 lines (21 loc) · 852 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
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class THServer extends THImpl {
public static void main(String[] args) {
try {
// Create the implementation object
THImpl impl = new THImpl();
// Export it dynamically (no need to run rmic)
THInterface stub = (THInterface) UnicastRemoteObject.exportObject(impl, 0);
// Get or create registry
Registry reg = LocateRegistry.getRegistry();
reg.bind("THRegistry", stub);
System.out.println("server ready");
} catch (Exception e) {
System.err.println("server exception: " + e.toString());
e.printStackTrace();
}
}
}