mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-03 04:30:06 +00:00
8068721: RMI-IIOP communication fails when ConcurrentHashMap is passed to remote method
Reviewed-by: chegar, alanb
This commit is contained in:
parent
ec05163d91
commit
5a24e90bdd
@ -8,7 +8,7 @@ keys=2d dnd i18n intermittent
|
||||
othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation
|
||||
|
||||
# Tests that cannot run concurrently
|
||||
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream
|
||||
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream javax/rmi
|
||||
|
||||
# Group definitions
|
||||
groups=TEST.groups [closed/TEST.groups]
|
||||
|
||||
@ -138,7 +138,6 @@ jdk_time = \
|
||||
|
||||
jdk_rmi = \
|
||||
java/rmi \
|
||||
javax/rmi/ssl \
|
||||
sun/rmi
|
||||
|
||||
jdk_security1 = \
|
||||
@ -237,6 +236,7 @@ jdk_tools = \
|
||||
jdk_other = \
|
||||
java/sql \
|
||||
javax/sql \
|
||||
javax/rmi \
|
||||
javax/naming \
|
||||
javax/script \
|
||||
javax/smartcardio \
|
||||
|
||||
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8068721
|
||||
* @summary test RMI-IIOP call with ConcurrentHashMap as an argument
|
||||
* @library /lib/testlibrary
|
||||
* @build jdk.testlibrary.*
|
||||
* @build Test HelloInterface HelloServer HelloClient HelloImpl _HelloImpl_Tie _HelloInterface_Stub ConcurrentHashMapTest
|
||||
* @run main/othervm -Djava.naming.provider.url=iiop://localhost:1050 -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest
|
||||
*/
|
||||
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import jdk.testlibrary.JDKToolFinder;
|
||||
import jdk.testlibrary.JDKToolLauncher;
|
||||
|
||||
public class ConcurrentHashMapTest {
|
||||
|
||||
static final String ORBD = JDKToolFinder.getTestJDKTool("orbd");
|
||||
static final String JAVA = JDKToolFinder.getTestJDKTool("java");
|
||||
static final JDKToolLauncher orbdLauncher = JDKToolLauncher.createUsingTestJDK("orbd");
|
||||
static final String CLASSPATH = System.getProperty("java.class.path");
|
||||
static final int FIVE_SECONDS = 5000;
|
||||
|
||||
private static Exception clientException;
|
||||
private static boolean exceptionInClient;
|
||||
private static Process orbdProcess;
|
||||
private static Process rmiServerProcess;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
startTestComponents();
|
||||
stopTestComponents();
|
||||
System.err.println("Test completed OK ");
|
||||
}
|
||||
|
||||
static void startTestComponents () throws Exception {
|
||||
startOrbd();
|
||||
Thread.sleep(FIVE_SECONDS);
|
||||
startRmiIiopServer();
|
||||
Thread.sleep(FIVE_SECONDS);
|
||||
executeRmiIiopClient();
|
||||
}
|
||||
|
||||
private static void stopTestComponents() throws Exception {
|
||||
stopRmiIiopServer();
|
||||
stopOrbd();
|
||||
if (exceptionInClient) {
|
||||
throw new RuntimeException(clientException);
|
||||
} else if (!isResponseReceived()) {
|
||||
throw new RuntimeException("Expected Response not received");
|
||||
}
|
||||
}
|
||||
|
||||
static void startOrbd() throws Exception {
|
||||
System.out.println("\nStarting orbd on port 1050 ");
|
||||
|
||||
//orbd -ORBInitialHost localhost -ORBInitialPort 1050
|
||||
orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost")
|
||||
.addToolArg("-ORBInitialPort").addToolArg("1050");
|
||||
|
||||
System.out.println("ConcurrentHashMapTest: Executing: " + Arrays.asList(orbdLauncher.getCommand()));
|
||||
ProcessBuilder pb = new ProcessBuilder(orbdLauncher.getCommand());
|
||||
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||
orbdProcess = pb.start();
|
||||
}
|
||||
|
||||
|
||||
static void startRmiIiopServer() throws Exception {
|
||||
System.out.println("\nStarting RmiServer");
|
||||
// java -cp .
|
||||
// -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
|
||||
// -Djava.naming.provider.url=iiop://localhost:1050 HelloServer
|
||||
List<String> commands = new ArrayList<>();
|
||||
commands.add(ConcurrentHashMapTest.JAVA);
|
||||
commands.add("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory");
|
||||
commands.add("-Djava.naming.provider.url=iiop://localhost:1050");
|
||||
commands.add("-cp");
|
||||
commands.add(ConcurrentHashMapTest.CLASSPATH);
|
||||
commands.add("HelloServer");
|
||||
|
||||
System.out.println("ConcurrentHashMapTest: Executing: " + commands);
|
||||
ProcessBuilder pb = new ProcessBuilder(commands);
|
||||
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
|
||||
rmiServerProcess = pb.start();
|
||||
}
|
||||
|
||||
static boolean isResponseReceived() {
|
||||
return HelloClient.isResponseReceived();
|
||||
}
|
||||
|
||||
static void stopRmiIiopServer() throws Exception {
|
||||
rmiServerProcess.destroy();
|
||||
rmiServerProcess.waitFor();
|
||||
//rmiServerProcess.waitFor(30, TimeUnit.SECONDS);
|
||||
System.out.println("serverProcess exitCode:"
|
||||
+ rmiServerProcess.exitValue());
|
||||
}
|
||||
|
||||
static void stopOrbd() throws Exception {
|
||||
orbdProcess.destroy();
|
||||
orbdProcess.waitFor();
|
||||
//orbdProcess.waitFor(30, TimeUnit.SECONDS);
|
||||
System.out.println("orbd exitCode:"
|
||||
+ orbdProcess.exitValue());
|
||||
}
|
||||
|
||||
static void executeRmiIiopClient() throws Exception {
|
||||
try {
|
||||
HelloClient.executeRmiClientCall();
|
||||
} catch (Exception ex) {
|
||||
clientException = ex;
|
||||
exceptionInClient = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
98
jdk/test/javax/rmi/PortableRemoteObject/HelloClient.java
Normal file
98
jdk/test/javax/rmi/PortableRemoteObject/HelloClient.java
Normal file
@ -0,0 +1,98 @@
|
||||
import java.rmi.RemoteException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.MalformedURLException;
|
||||
import java.rmi.NotBoundException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NameNotFoundException;
|
||||
import javax.naming.NamingException;
|
||||
import javax.rmi.PortableRemoteObject;
|
||||
|
||||
import org.omg.CORBA.Any;
|
||||
import org.omg.CORBA.ORB;
|
||||
|
||||
public class HelloClient implements Runnable {
|
||||
static final int MAX_RETRY = 10;
|
||||
static final int ONE_SECOND = 1000;
|
||||
private static boolean responseReceived;
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
executeRmiClientCall();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
executeRmiClientCall();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isResponseReceived () {
|
||||
return responseReceived;
|
||||
}
|
||||
|
||||
public static void executeRmiClientCall() throws Exception {
|
||||
Context ic;
|
||||
Object objref;
|
||||
HelloInterface helloSvc;
|
||||
String response;
|
||||
int retryCount = 0;
|
||||
|
||||
Test test = new Test();
|
||||
System.out.println("HelloClient.main: enter ...");
|
||||
while (retryCount < MAX_RETRY) {
|
||||
try {
|
||||
ic = new InitialContext();
|
||||
System.out.println("HelloClient.main: HelloService lookup ...");
|
||||
// STEP 1: Get the Object reference from the Name Service
|
||||
// using JNDI call.
|
||||
objref = ic.lookup("HelloService");
|
||||
System.out.println("HelloClient: Obtained a ref. to Hello server.");
|
||||
|
||||
// STEP 2: Narrow the object reference to the concrete type and
|
||||
// invoke the method.
|
||||
helloSvc = (HelloInterface) PortableRemoteObject.narrow(objref,
|
||||
HelloInterface.class);
|
||||
System.out.println("HelloClient: Invoking on remote server with ConcurrentHashMap parameter");
|
||||
ConcurrentHashMap <String, String> testConcurrentHashMap = new ConcurrentHashMap<String, String>();
|
||||
response = helloSvc.sayHelloWithHashMap(testConcurrentHashMap);
|
||||
System.out.println("HelloClient: Server says: " + response);
|
||||
if (!response.contains("Hello with hashMapSize ==")) {
|
||||
System.out.println("HelloClient: expected response not received");
|
||||
throw new RuntimeException("Expected Response Hello with hashMapSize == 0 not received");
|
||||
}
|
||||
responseReceived = true;
|
||||
break;
|
||||
} catch (NameNotFoundException nnfEx) {
|
||||
System.err.println("NameNotFoundException Caught .... try again");
|
||||
retryCount++;
|
||||
try {
|
||||
Thread.sleep(ONE_SECOND);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
continue;
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception " + e + "Caught");
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
System.err.println("HelloClient terminating ");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
60
jdk/test/javax/rmi/PortableRemoteObject/HelloImpl.java
Normal file
60
jdk/test/javax/rmi/PortableRemoteObject/HelloImpl.java
Normal file
@ -0,0 +1,60 @@
|
||||
import java.net.InetAddress;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import javax.rmi.PortableRemoteObject;
|
||||
|
||||
public class HelloImpl extends PortableRemoteObject implements HelloInterface {
|
||||
public HelloImpl() throws java.rmi.RemoteException {
|
||||
super(); // invoke rmi linking and remote object initialization
|
||||
}
|
||||
|
||||
public String sayHello(String from) throws java.rmi.RemoteException {
|
||||
System.out.println("Hello from " + from + "!!");
|
||||
System.out.flush();
|
||||
String reply = "Hello from us to you " + from;
|
||||
return reply;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sayHelloToTest(Test test) throws RemoteException {
|
||||
return "Test says Hello";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sayHelloWithInetAddress(InetAddress ipAddr)
|
||||
throws RemoteException {
|
||||
String response = "Hello with InetAddress " + ipAddr.toString();
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sayHelloWithHashMap(ConcurrentHashMap<String, String> receivedHashMap)
|
||||
throws RemoteException {
|
||||
int hashMapSize = 0;
|
||||
|
||||
hashMapSize = receivedHashMap.size();
|
||||
String response = "Hello with hashMapSize == " + hashMapSize;
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sayHelloWithHashMap2(HashMap<String, String> receivedHashMap)
|
||||
throws RemoteException {
|
||||
int hashMapSize = 0;
|
||||
|
||||
hashMapSize = receivedHashMap.size();
|
||||
String response = "Hello with hashMapSize == " + hashMapSize;
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sayHelloWithReentrantLock(ReentrantLock receivedLock)
|
||||
throws RemoteException {
|
||||
|
||||
String response = "Hello with lock == " + receivedLock.isLocked();
|
||||
return response;
|
||||
}
|
||||
}
|
||||
14
jdk/test/javax/rmi/PortableRemoteObject/HelloInterface.java
Normal file
14
jdk/test/javax/rmi/PortableRemoteObject/HelloInterface.java
Normal file
@ -0,0 +1,14 @@
|
||||
import java.net.InetAddress;
|
||||
import java.rmi.Remote;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public interface HelloInterface extends Remote {
|
||||
public String sayHello( String from ) throws java.rmi.RemoteException;
|
||||
public String sayHelloToTest( Test test ) throws java.rmi.RemoteException;
|
||||
public String sayHelloWithInetAddress( InetAddress ipAddr ) throws java.rmi.RemoteException;
|
||||
public String sayHelloWithHashMap(ConcurrentHashMap<String, String> hashMap ) throws java.rmi.RemoteException;
|
||||
public String sayHelloWithHashMap2(HashMap<String, String> hashMap ) throws java.rmi.RemoteException;
|
||||
public String sayHelloWithReentrantLock(ReentrantLock lock ) throws java.rmi.RemoteException;
|
||||
}
|
||||
36
jdk/test/javax/rmi/PortableRemoteObject/HelloServer.java
Normal file
36
jdk/test/javax/rmi/PortableRemoteObject/HelloServer.java
Normal file
@ -0,0 +1,36 @@
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.Context;
|
||||
|
||||
public class HelloServer {
|
||||
|
||||
static final int MAX_RETRY = 10;
|
||||
static final int ONE_SECOND = 1000;
|
||||
|
||||
public static void main(String[] args) {
|
||||
int retryCount = 0;
|
||||
while (retryCount < MAX_RETRY) {
|
||||
try {
|
||||
//HelloServer.set("SETTING TEST ITL");
|
||||
// Step 1: Instantiate the Hello servant
|
||||
HelloImpl helloRef = new HelloImpl();
|
||||
|
||||
// Step 2: Publish the reference in the Naming Service
|
||||
// using JNDI API
|
||||
Context initialNamingContext = new InitialContext();
|
||||
initialNamingContext.rebind("HelloService", helloRef);
|
||||
|
||||
System.out.println("Hello Server: Ready...");
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
System.out.println("Server initialization problem: " + e);
|
||||
e.printStackTrace();
|
||||
retryCount++;
|
||||
try {
|
||||
Thread.sleep(ONE_SECOND);
|
||||
} catch (InterruptedException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
jdk/test/javax/rmi/PortableRemoteObject/Test.java
Normal file
6
jdk/test/javax/rmi/PortableRemoteObject/Test.java
Normal file
@ -0,0 +1,6 @@
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
public class Test implements Serializable {
|
||||
|
||||
}
|
||||
128
jdk/test/javax/rmi/PortableRemoteObject/_HelloImpl_Tie.java
Normal file
128
jdk/test/javax/rmi/PortableRemoteObject/_HelloImpl_Tie.java
Normal file
@ -0,0 +1,128 @@
|
||||
// Tie class generated by rmic, do not edit.
|
||||
// Contents subject to change without notice.
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.InetAddress;
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import javax.rmi.CORBA.Tie;
|
||||
import javax.rmi.CORBA.Util;
|
||||
import org.omg.CORBA.BAD_OPERATION;
|
||||
import org.omg.CORBA.ORB;
|
||||
import org.omg.CORBA.SystemException;
|
||||
import org.omg.CORBA.portable.InputStream;
|
||||
import org.omg.CORBA.portable.OutputStream;
|
||||
import org.omg.CORBA.portable.ResponseHandler;
|
||||
import org.omg.CORBA.portable.UnknownException;
|
||||
import org.omg.CORBA_2_3.portable.ObjectImpl;
|
||||
|
||||
|
||||
public class _HelloImpl_Tie extends ObjectImpl implements Tie {
|
||||
|
||||
private HelloImpl target = null;
|
||||
|
||||
private static final String[] _type_ids = {
|
||||
"RMI:HelloInterface:0000000000000000"
|
||||
};
|
||||
|
||||
public void setTarget(Remote target) {
|
||||
this.target = (HelloImpl) target;
|
||||
}
|
||||
|
||||
public Remote getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public org.omg.CORBA.Object thisObject() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void deactivate() {
|
||||
_orb().disconnect(this);
|
||||
_set_delegate(null);
|
||||
target = null;
|
||||
}
|
||||
|
||||
public ORB orb() {
|
||||
return _orb();
|
||||
}
|
||||
|
||||
public void orb(ORB orb) {
|
||||
orb.connect(this);
|
||||
}
|
||||
|
||||
public String[] _ids() {
|
||||
return (String[]) _type_ids.clone();
|
||||
}
|
||||
|
||||
public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.InputStream in =
|
||||
(org.omg.CORBA_2_3.portable.InputStream) _in;
|
||||
switch (method.length()) {
|
||||
case 8:
|
||||
if (method.equals("sayHello")) {
|
||||
String arg0 = (String) in.read_value(String.class);
|
||||
String result = target.sayHello(arg0);
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
|
||||
out.write_value(result,String.class);
|
||||
return out;
|
||||
}
|
||||
case 14:
|
||||
if (method.equals("sayHelloToTest")) {
|
||||
Test arg0 = (Test) in.read_value(Test.class);
|
||||
String result = target.sayHelloToTest(arg0);
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
|
||||
out.write_value(result,String.class);
|
||||
return out;
|
||||
}
|
||||
case 19:
|
||||
if (method.equals("sayHelloWithHashMap")) {
|
||||
ConcurrentHashMap arg0 = (ConcurrentHashMap) in.read_value(ConcurrentHashMap.class);
|
||||
String result = target.sayHelloWithHashMap(arg0);
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
|
||||
out.write_value(result,String.class);
|
||||
return out;
|
||||
}
|
||||
case 20:
|
||||
if (method.equals("sayHelloWithHashMap2")) {
|
||||
HashMap arg0 = (HashMap) in.read_value(HashMap.class);
|
||||
String result = target.sayHelloWithHashMap2(arg0);
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
|
||||
out.write_value(result,String.class);
|
||||
return out;
|
||||
}
|
||||
case 23:
|
||||
if (method.equals("sayHelloWithInetAddress")) {
|
||||
InetAddress arg0 = (InetAddress) in.read_value(InetAddress.class);
|
||||
String result = target.sayHelloWithInetAddress(arg0);
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
|
||||
out.write_value(result,String.class);
|
||||
return out;
|
||||
}
|
||||
case 25:
|
||||
if (method.equals("sayHelloWithReentrantLock")) {
|
||||
ReentrantLock arg0 = (ReentrantLock) in.read_value(ReentrantLock.class);
|
||||
String result = target.sayHelloWithReentrantLock(arg0);
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
|
||||
out.write_value(result,String.class);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
throw new BAD_OPERATION();
|
||||
} catch (SystemException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
throw new UnknownException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,272 @@
|
||||
// Stub class generated by rmic, do not edit.
|
||||
// Contents subject to change without notice.
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.InetAddress;
|
||||
import java.rmi.Remote;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.UnexpectedException;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import javax.rmi.CORBA.Stub;
|
||||
import javax.rmi.CORBA.Util;
|
||||
import org.omg.CORBA.ORB;
|
||||
import org.omg.CORBA.SystemException;
|
||||
import org.omg.CORBA.portable.ApplicationException;
|
||||
import org.omg.CORBA.portable.InputStream;
|
||||
import org.omg.CORBA.portable.OutputStream;
|
||||
import org.omg.CORBA.portable.RemarshalException;
|
||||
import org.omg.CORBA.portable.ResponseHandler;
|
||||
import org.omg.CORBA.portable.ServantObject;
|
||||
|
||||
|
||||
public class _HelloInterface_Stub extends Stub implements HelloInterface {
|
||||
|
||||
private static final String[] _type_ids = {
|
||||
"RMI:HelloInterface:0000000000000000"
|
||||
};
|
||||
|
||||
public String[] _ids() {
|
||||
return (String[]) _type_ids.clone();
|
||||
}
|
||||
|
||||
public String sayHello(String arg0) throws java.rmi.RemoteException {
|
||||
if (!Util.isLocal(this)) {
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.InputStream in = null;
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream)
|
||||
_request("sayHello", true);
|
||||
out.write_value(arg0,String.class);
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
|
||||
return (String) in.read_value(String.class);
|
||||
} catch (ApplicationException ex) {
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
|
||||
String $_id = in.read_string();
|
||||
throw new UnexpectedException($_id);
|
||||
} catch (RemarshalException ex) {
|
||||
return sayHello(arg0);
|
||||
} finally {
|
||||
_releaseReply(in);
|
||||
}
|
||||
} catch (SystemException ex) {
|
||||
throw Util.mapSystemException(ex);
|
||||
}
|
||||
} else {
|
||||
ServantObject so = _servant_preinvoke("sayHello",HelloInterface.class);
|
||||
if (so == null) {
|
||||
return sayHello(arg0);
|
||||
}
|
||||
try {
|
||||
return ((HelloInterface)so.servant).sayHello(arg0);
|
||||
} catch (Throwable ex) {
|
||||
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
|
||||
throw Util.wrapException(exCopy);
|
||||
} finally {
|
||||
_servant_postinvoke(so);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String sayHelloToTest(Test arg0) throws java.rmi.RemoteException {
|
||||
if (!Util.isLocal(this)) {
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.InputStream in = null;
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream)
|
||||
_request("sayHelloToTest", true);
|
||||
out.write_value(arg0,Test.class);
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
|
||||
return (String) in.read_value(String.class);
|
||||
} catch (ApplicationException ex) {
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
|
||||
String $_id = in.read_string();
|
||||
throw new UnexpectedException($_id);
|
||||
} catch (RemarshalException ex) {
|
||||
return sayHelloToTest(arg0);
|
||||
} finally {
|
||||
_releaseReply(in);
|
||||
}
|
||||
} catch (SystemException ex) {
|
||||
throw Util.mapSystemException(ex);
|
||||
}
|
||||
} else {
|
||||
ServantObject so = _servant_preinvoke("sayHelloToTest",HelloInterface.class);
|
||||
if (so == null) {
|
||||
return sayHelloToTest(arg0);
|
||||
}
|
||||
try {
|
||||
Test arg0Copy = (Test) Util.copyObject(arg0,_orb());
|
||||
return ((HelloInterface)so.servant).sayHelloToTest(arg0Copy);
|
||||
} catch (Throwable ex) {
|
||||
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
|
||||
throw Util.wrapException(exCopy);
|
||||
} finally {
|
||||
_servant_postinvoke(so);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String sayHelloWithInetAddress(InetAddress arg0) throws java.rmi.RemoteException {
|
||||
if (!Util.isLocal(this)) {
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.InputStream in = null;
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream)
|
||||
_request("sayHelloWithInetAddress", true);
|
||||
out.write_value(arg0,InetAddress.class);
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
|
||||
return (String) in.read_value(String.class);
|
||||
} catch (ApplicationException ex) {
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
|
||||
String $_id = in.read_string();
|
||||
throw new UnexpectedException($_id);
|
||||
} catch (RemarshalException ex) {
|
||||
return sayHelloWithInetAddress(arg0);
|
||||
} finally {
|
||||
_releaseReply(in);
|
||||
}
|
||||
} catch (SystemException ex) {
|
||||
throw Util.mapSystemException(ex);
|
||||
}
|
||||
} else {
|
||||
ServantObject so = _servant_preinvoke("sayHelloWithInetAddress",HelloInterface.class);
|
||||
if (so == null) {
|
||||
return sayHelloWithInetAddress(arg0);
|
||||
}
|
||||
try {
|
||||
InetAddress arg0Copy = (InetAddress) Util.copyObject(arg0,_orb());
|
||||
return ((HelloInterface)so.servant).sayHelloWithInetAddress(arg0Copy);
|
||||
} catch (Throwable ex) {
|
||||
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
|
||||
throw Util.wrapException(exCopy);
|
||||
} finally {
|
||||
_servant_postinvoke(so);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String sayHelloWithHashMap(ConcurrentHashMap arg0) throws java.rmi.RemoteException {
|
||||
if (!Util.isLocal(this)) {
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.InputStream in = null;
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream)
|
||||
_request("sayHelloWithHashMap", true);
|
||||
out.write_value(arg0,ConcurrentHashMap.class);
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
|
||||
return (String) in.read_value(String.class);
|
||||
} catch (ApplicationException ex) {
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
|
||||
String $_id = in.read_string();
|
||||
throw new UnexpectedException($_id);
|
||||
} catch (RemarshalException ex) {
|
||||
return sayHelloWithHashMap(arg0);
|
||||
} finally {
|
||||
_releaseReply(in);
|
||||
}
|
||||
} catch (SystemException ex) {
|
||||
throw Util.mapSystemException(ex);
|
||||
}
|
||||
} else {
|
||||
ServantObject so = _servant_preinvoke("sayHelloWithHashMap",HelloInterface.class);
|
||||
if (so == null) {
|
||||
return sayHelloWithHashMap(arg0);
|
||||
}
|
||||
try {
|
||||
ConcurrentHashMap arg0Copy = (ConcurrentHashMap) Util.copyObject(arg0,_orb());
|
||||
return ((HelloInterface)so.servant).sayHelloWithHashMap(arg0Copy);
|
||||
} catch (Throwable ex) {
|
||||
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
|
||||
throw Util.wrapException(exCopy);
|
||||
} finally {
|
||||
_servant_postinvoke(so);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String sayHelloWithHashMap2(HashMap arg0) throws java.rmi.RemoteException {
|
||||
if (!Util.isLocal(this)) {
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.InputStream in = null;
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream)
|
||||
_request("sayHelloWithHashMap2", true);
|
||||
out.write_value(arg0,HashMap.class);
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
|
||||
return (String) in.read_value(String.class);
|
||||
} catch (ApplicationException ex) {
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
|
||||
String $_id = in.read_string();
|
||||
throw new UnexpectedException($_id);
|
||||
} catch (RemarshalException ex) {
|
||||
return sayHelloWithHashMap2(arg0);
|
||||
} finally {
|
||||
_releaseReply(in);
|
||||
}
|
||||
} catch (SystemException ex) {
|
||||
throw Util.mapSystemException(ex);
|
||||
}
|
||||
} else {
|
||||
ServantObject so = _servant_preinvoke("sayHelloWithHashMap2",HelloInterface.class);
|
||||
if (so == null) {
|
||||
return sayHelloWithHashMap2(arg0);
|
||||
}
|
||||
try {
|
||||
HashMap arg0Copy = (HashMap) Util.copyObject(arg0,_orb());
|
||||
return ((HelloInterface)so.servant).sayHelloWithHashMap2(arg0Copy);
|
||||
} catch (Throwable ex) {
|
||||
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
|
||||
throw Util.wrapException(exCopy);
|
||||
} finally {
|
||||
_servant_postinvoke(so);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String sayHelloWithReentrantLock(ReentrantLock arg0) throws java.rmi.RemoteException {
|
||||
if (!Util.isLocal(this)) {
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.InputStream in = null;
|
||||
try {
|
||||
org.omg.CORBA_2_3.portable.OutputStream out =
|
||||
(org.omg.CORBA_2_3.portable.OutputStream)
|
||||
_request("sayHelloWithReentrantLock", true);
|
||||
out.write_value(arg0,ReentrantLock.class);
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
|
||||
return (String) in.read_value(String.class);
|
||||
} catch (ApplicationException ex) {
|
||||
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
|
||||
String $_id = in.read_string();
|
||||
throw new UnexpectedException($_id);
|
||||
} catch (RemarshalException ex) {
|
||||
return sayHelloWithReentrantLock(arg0);
|
||||
} finally {
|
||||
_releaseReply(in);
|
||||
}
|
||||
} catch (SystemException ex) {
|
||||
throw Util.mapSystemException(ex);
|
||||
}
|
||||
} else {
|
||||
ServantObject so = _servant_preinvoke("sayHelloWithReentrantLock",HelloInterface.class);
|
||||
if (so == null) {
|
||||
return sayHelloWithReentrantLock(arg0);
|
||||
}
|
||||
try {
|
||||
ReentrantLock arg0Copy = (ReentrantLock) Util.copyObject(arg0,_orb());
|
||||
return ((HelloInterface)so.servant).sayHelloWithReentrantLock(arg0Copy);
|
||||
} catch (Throwable ex) {
|
||||
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
|
||||
throw Util.wrapException(exCopy);
|
||||
} finally {
|
||||
_servant_postinvoke(so);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user