Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/rmi/PortableRemoteObject/HelloImpl.java
38839 views
1
import java.net.InetAddress;
2
import java.rmi.RemoteException;
3
import java.util.HashMap;
4
import java.util.concurrent.ConcurrentHashMap;
5
import java.util.concurrent.locks.ReentrantLock;
6
7
import javax.rmi.PortableRemoteObject;
8
9
public class HelloImpl extends PortableRemoteObject implements HelloInterface {
10
public HelloImpl() throws java.rmi.RemoteException {
11
super(); // invoke rmi linking and remote object initialization
12
}
13
14
public String sayHello(String from) throws java.rmi.RemoteException {
15
System.out.println("Hello from " + from + "!!");
16
System.out.flush();
17
String reply = "Hello from us to you " + from;
18
return reply;
19
}
20
21
@Override
22
public String sayHelloToTest(Test test) throws RemoteException {
23
return "Test says Hello";
24
}
25
26
@Override
27
public String sayHelloWithInetAddress(InetAddress ipAddr)
28
throws RemoteException {
29
String response = "Hello with InetAddress " + ipAddr.toString();
30
return response;
31
}
32
33
@Override
34
public String sayHelloWithHashMap(ConcurrentHashMap<String, String> receivedHashMap)
35
throws RemoteException {
36
int hashMapSize = 0;
37
38
hashMapSize = receivedHashMap.size();
39
String response = "Hello with hashMapSize == " + hashMapSize;
40
return response;
41
}
42
43
@Override
44
public String sayHelloWithHashMap2(HashMap<String, String> receivedHashMap)
45
throws RemoteException {
46
int hashMapSize = 0;
47
48
hashMapSize = receivedHashMap.size();
49
String response = "Hello with hashMapSize == " + hashMapSize;
50
return response;
51
}
52
53
@Override
54
public String sayHelloWithReentrantLock(ReentrantLock receivedLock)
55
throws RemoteException {
56
57
String response = "Hello with lock == " + receivedLock.isLocked();
58
return response;
59
}
60
}
61
62