forked from BinaryBall/java-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyServiceImpl.java
More file actions
38 lines (31 loc) · 901 Bytes
/
MyServiceImpl.java
File metadata and controls
38 lines (31 loc) · 901 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
33
34
35
36
37
38
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;
/**
* rmi
* 2019/9/27 15:25
* rmi myservice impl
*
* @author 曾小辉
**/
public class MyServiceImpl extends UnicastRemoteObject implements MyService {
private static final long serialVersionUID = -271947229644133464L;
// public String sayHello() throws RemoteException {
// return "你好!!!!!";
// }
@Override
public String sayHello() throws RemoteException {
return "哈哈";
}
public MyServiceImpl() throws RemoteException {
}
public static void main(String[] args) {
try {
MyService service = new MyServiceImpl();
Naming.bind("rmi://127.0.0.1:1099/hello", service);
} catch (Exception e) {
e.printStackTrace();
}
}
}