1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.newsclub.net.unix.demo.rmi;
19
20 import java.io.IOException;
21 import java.rmi.AlreadyBoundException;
22
23 import org.newsclub.net.unix.demo.rmi.services.HelloWorld;
24 import org.newsclub.net.unix.rmi.AFUNIXNaming;
25
26
27
28
29
30
31
32 public final class SimpleRMIServer {
33 public static void main(String[] args) throws IOException, AlreadyBoundException {
34 AFUNIXNaming naming = AFUNIXNaming.getInstance();
35 naming.createRegistry();
36
37 System.out.println("Using " + naming.getSocketFactory());
38
39 HelloWorldImpl obj = new HelloWorldImpl(naming);
40 System.out.println("Binding " + obj.toString() + " to \"helloWorld\"...");
41 naming.exportAndBind("helloWorld", obj);
42
43 System.out.println("Ready to accept connections!");
44 }
45 }