Path: blob/master/test/jdk/java/rmi/registry/interfaceHash/ReferenceRegistryStub.java
41153 views
/*1* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223public final class ReferenceRegistryStub24extends java.rmi.server.RemoteStub25implements java.rmi.registry.Registry, java.rmi.Remote26{27private static final java.rmi.server.Operation[] operations = {28new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"),29new java.rmi.server.Operation("java.lang.String list()[]"),30new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String)"),31new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"),32new java.rmi.server.Operation("void unbind(java.lang.String)")33};3435private static final long interfaceHash = 4905912898345647071L;3637// constructors38public ReferenceRegistryStub() {39super();40}41public ReferenceRegistryStub(java.rmi.server.RemoteRef ref) {42super(ref);43}4445// methods from remote interfaces4647// implementation of bind(String, Remote)48public void bind(java.lang.String $param_String_1, java.rmi.Remote $param_Remote_2)49throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException50{51try {52java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);53try {54java.io.ObjectOutput out = call.getOutputStream();55out.writeObject($param_String_1);56out.writeObject($param_Remote_2);57} catch (java.io.IOException e) {58throw new java.rmi.MarshalException("error marshalling arguments", e);59}60ref.invoke(call);61ref.done(call);62} catch (java.lang.RuntimeException e) {63throw e;64} catch (java.rmi.RemoteException e) {65throw e;66} catch (java.rmi.AlreadyBoundException e) {67throw e;68} catch (java.lang.Exception e) {69throw new java.rmi.UnexpectedException("undeclared checked exception", e);70}71}7273// implementation of list()74public java.lang.String[] list()75throws java.rmi.AccessException, java.rmi.RemoteException76{77try {78java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);79ref.invoke(call);80java.lang.String[] $result;81try {82java.io.ObjectInput in = call.getInputStream();83$result = (java.lang.String[]) in.readObject();84} catch (java.io.IOException e) {85throw new java.rmi.UnmarshalException("error unmarshalling return", e);86} catch (java.lang.ClassNotFoundException e) {87throw new java.rmi.UnmarshalException("error unmarshalling return", e);88} finally {89ref.done(call);90}91return $result;92} catch (java.lang.RuntimeException e) {93throw e;94} catch (java.rmi.RemoteException e) {95throw e;96} catch (java.lang.Exception e) {97throw new java.rmi.UnexpectedException("undeclared checked exception", e);98}99}100101// implementation of lookup(String)102public java.rmi.Remote lookup(java.lang.String $param_String_1)103throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException104{105try {106java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 2, interfaceHash);107try {108java.io.ObjectOutput out = call.getOutputStream();109out.writeObject($param_String_1);110} catch (java.io.IOException e) {111throw new java.rmi.MarshalException("error marshalling arguments", e);112}113ref.invoke(call);114java.rmi.Remote $result;115try {116java.io.ObjectInput in = call.getInputStream();117$result = (java.rmi.Remote) in.readObject();118} catch (java.io.IOException e) {119throw new java.rmi.UnmarshalException("error unmarshalling return", e);120} catch (java.lang.ClassNotFoundException e) {121throw new java.rmi.UnmarshalException("error unmarshalling return", e);122} finally {123ref.done(call);124}125return $result;126} catch (java.lang.RuntimeException e) {127throw e;128} catch (java.rmi.RemoteException e) {129throw e;130} catch (java.rmi.NotBoundException e) {131throw e;132} catch (java.lang.Exception e) {133throw new java.rmi.UnexpectedException("undeclared checked exception", e);134}135}136137// implementation of rebind(String, Remote)138public void rebind(java.lang.String $param_String_1, java.rmi.Remote $param_Remote_2)139throws java.rmi.AccessException, java.rmi.RemoteException140{141try {142java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 3, interfaceHash);143try {144java.io.ObjectOutput out = call.getOutputStream();145out.writeObject($param_String_1);146out.writeObject($param_Remote_2);147} catch (java.io.IOException e) {148throw new java.rmi.MarshalException("error marshalling arguments", e);149}150ref.invoke(call);151ref.done(call);152} catch (java.lang.RuntimeException e) {153throw e;154} catch (java.rmi.RemoteException e) {155throw e;156} catch (java.lang.Exception e) {157throw new java.rmi.UnexpectedException("undeclared checked exception", e);158}159}160161// implementation of unbind(String)162public void unbind(java.lang.String $param_String_1)163throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException164{165try {166java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 4, interfaceHash);167try {168java.io.ObjectOutput out = call.getOutputStream();169out.writeObject($param_String_1);170} catch (java.io.IOException e) {171throw new java.rmi.MarshalException("error marshalling arguments", e);172}173ref.invoke(call);174ref.done(call);175} catch (java.lang.RuntimeException e) {176throw e;177} catch (java.rmi.RemoteException e) {178throw e;179} catch (java.rmi.NotBoundException e) {180throw e;181} catch (java.lang.Exception e) {182throw new java.rmi.UnexpectedException("undeclared checked exception", e);183}184}185}186187188