home *** CD-ROM | disk | FTP | other *** search
- package sun.rmi.server;
-
- import java.io.IOException;
- import java.io.ObjectInput;
- import java.io.ObjectOutput;
- import java.io.Serializable;
- import java.rmi.RemoteException;
- import java.rmi.server.LogStream;
- import java.rmi.server.Operation;
- import java.rmi.server.RemoteCall;
- import java.rmi.server.RemoteObject;
- import java.rmi.server.RemoteRef;
- import sun.rmi.transport.Connection;
- import sun.rmi.transport.LiveRef;
- import sun.rmi.transport.StreamRemoteCall;
-
- public class UnicastRef implements RemoteRef, Serializable {
- protected LiveRef ref;
-
- public UnicastRef() {
- }
-
- public UnicastRef(LiveRef var1) {
- this.ref = var1;
- }
-
- public RemoteCall newCall(RemoteObject var1, Operation[] var2, int var3, long var4) throws RemoteException {
- if (RemoteProxy.logLevel >= 10) {
- LogStream.log("transport").println("UnicastRef.newCall: get connection");
- }
-
- Connection var6 = this.ref.getChannel().newConnection();
-
- try {
- if (RemoteProxy.logLevel >= 20) {
- LogStream.log("transport").println("UnicastRef.newCall: create call");
- }
-
- StreamRemoteCall var7 = new StreamRemoteCall(var6, this.ref.getObjID(), var3, var4);
- return var7;
- } catch (RemoteException var8) {
- this.ref.getChannel().free(var6, false);
- throw var8;
- }
- }
-
- public void invoke(RemoteCall var1) throws Exception {
- try {
- if (RemoteProxy.logLevel >= 20) {
- LogStream.log("transport").println("UnicastRef.invoke: execute call");
- }
-
- var1.executeCall();
- } catch (RemoteException var4) {
- if (RemoteProxy.logLevel >= 10) {
- LogStream.log("transport").println("UnicastRef.invoke: exception occurred " + var4.getMessage());
- }
-
- Connection var6 = ((StreamRemoteCall)var1).getConnection();
- this.ref.getChannel().free(var6, false);
- throw var4;
- } catch (Exception var5) {
- if (RemoteProxy.logLevel >= 10) {
- LogStream.log("transport").println("UnicastRef.invoke: exception occurred " + ((Throwable)var5).getMessage());
- }
-
- Connection var3 = ((StreamRemoteCall)var1).getConnection();
- this.ref.getChannel().free(var3, true);
- throw var5;
- }
- }
-
- public void done(RemoteCall var1) throws RemoteException {
- boolean var2 = true;
-
- try {
- var1.done();
- } catch (IOException var4) {
- var2 = false;
- }
-
- if (RemoteProxy.logLevel >= 10) {
- LogStream.log("transport").println("UnicastRef.done: free connection (reuse = " + var2 + ")");
- }
-
- Connection var3 = ((StreamRemoteCall)var1).getConnection();
- this.ref.getChannel().free(var3, var2);
- }
-
- public String getRefClass(ObjectOutput var1) {
- return "UnicastRef";
- }
-
- public void writeExternal(ObjectOutput var1) throws IOException {
- this.ref.writeExternal(var1);
- }
-
- public void readExternal(ObjectInput var1) throws IOException, ClassNotFoundException {
- this.ref = new LiveRef();
- this.ref.readExternal(var1);
- }
-
- public String remoteToString() {
- return "RemoteStub [ref: " + this.ref + "]";
- }
-
- public int remoteHashCode() {
- return this.ref.hashCode();
- }
-
- public boolean remoteEquals(RemoteRef var1) {
- return var1 instanceof UnicastRef ? this.ref.remoteEquals(((UnicastRef)var1).ref) : false;
- }
- }
-