Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/rmi/PortableRemoteObject/HelloImpl.java
38839 views
import java.net.InetAddress;1import java.rmi.RemoteException;2import java.util.HashMap;3import java.util.concurrent.ConcurrentHashMap;4import java.util.concurrent.locks.ReentrantLock;56import javax.rmi.PortableRemoteObject;78public class HelloImpl extends PortableRemoteObject implements HelloInterface {9public HelloImpl() throws java.rmi.RemoteException {10super(); // invoke rmi linking and remote object initialization11}1213public String sayHello(String from) throws java.rmi.RemoteException {14System.out.println("Hello from " + from + "!!");15System.out.flush();16String reply = "Hello from us to you " + from;17return reply;18}1920@Override21public String sayHelloToTest(Test test) throws RemoteException {22return "Test says Hello";23}2425@Override26public String sayHelloWithInetAddress(InetAddress ipAddr)27throws RemoteException {28String response = "Hello with InetAddress " + ipAddr.toString();29return response;30}3132@Override33public String sayHelloWithHashMap(ConcurrentHashMap<String, String> receivedHashMap)34throws RemoteException {35int hashMapSize = 0;3637hashMapSize = receivedHashMap.size();38String response = "Hello with hashMapSize == " + hashMapSize;39return response;40}4142@Override43public String sayHelloWithHashMap2(HashMap<String, String> receivedHashMap)44throws RemoteException {45int hashMapSize = 0;4647hashMapSize = receivedHashMap.size();48String response = "Hello with hashMapSize == " + hashMapSize;49return response;50}5152@Override53public String sayHelloWithReentrantLock(ReentrantLock receivedLock)54throws RemoteException {5556String response = "Hello with lock == " + receivedLock.isLocked();57return response;58}59}606162