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.lang.reflect.Method;
- import java.rmi.ConnectException;
- import java.rmi.ConnectIOException;
- import java.rmi.MarshalException;
- import java.rmi.NoSuchObjectException;
- import java.rmi.Remote;
- import java.rmi.RemoteException;
- import java.rmi.ServerError;
- import java.rmi.ServerException;
- import java.rmi.StubNotFoundException;
- import java.rmi.UnknownHostException;
- import java.rmi.UnmarshalException;
- import java.rmi.activation.ActivateFailedException;
- import java.rmi.activation.ActivationDesc;
- import java.rmi.activation.ActivationID;
- import java.rmi.activation.UnknownObjectException;
- import java.rmi.server.Operation;
- import java.rmi.server.RMIClassLoader;
- import java.rmi.server.RemoteCall;
- import java.rmi.server.RemoteObject;
- import java.rmi.server.RemoteRef;
- import java.rmi.server.RemoteStub;
-
- public class ActivatableRef implements RemoteRef {
- // $FF: renamed from: id java.rmi.activation.ActivationID
- protected ActivationID field_0;
- protected RemoteRef ref;
- transient boolean force = false;
- private static final int MAX_RETRIES = 3;
- private static final String versionComplaint = "activation requires 1.2 stubs";
-
- public ActivatableRef() {
- }
-
- public ActivatableRef(ActivationID var1, RemoteRef var2) {
- this.field_0 = var1;
- this.ref = var2;
- }
-
- public static RemoteStub getStub(ActivationDesc var0, ActivationID var1) throws StubNotFoundException {
- String var2 = var0.getClassName();
-
- try {
- Class var3 = RMIClassLoader.loadClass(var0.getLocation(), var2);
- Class var4 = RemoteProxy.getRemoteClass(var3);
- return RemoteProxy.getStub(var4.getName(), var4, new ActivatableRef(var1, (RemoteRef)null));
- } catch (Exception var5) {
- throw new StubNotFoundException("unable to load class: " + var2, var5);
- }
- }
-
- public Object invoke(Remote var1, Method var2, Object[] var3, long var4) throws Exception {
- boolean var6 = false;
- Object var8 = null;
- RemoteRef var7;
- synchronized(this) {
- if (this.ref == null) {
- var7 = this.activate(var6);
- var6 = true;
- } else {
- var7 = this.ref;
- }
- }
-
- for(int var10 = 3; var10 > 0; --var10) {
- try {
- return var7.invoke(var1, var2, var3, var4);
- } catch (NoSuchObjectException var24) {
- var8 = var24;
- } catch (ConnectException var25) {
- var8 = var25;
- } catch (UnknownHostException var26) {
- var8 = var26;
- } catch (ConnectIOException var27) {
- var8 = var27;
- } catch (MarshalException var28) {
- throw var28;
- } catch (ServerError var29) {
- throw var29;
- } catch (ServerException var30) {
- throw var30;
- } catch (RemoteException var31) {
- synchronized(this) {
- if (var7 == this.ref) {
- this.ref = null;
- }
- }
-
- throw var31;
- }
-
- if (var10 > 1) {
- synchronized(this) {
- if (!var7.equals(this.ref) && this.ref != null) {
- var7 = this.ref;
- var6 = false;
- } else {
- RemoteRef var12 = this.activate(var6);
- if (var12.equals(var7) && var8 instanceof NoSuchObjectException && !var6) {
- var12 = this.activate(true);
- }
-
- var7 = var12;
- var6 = true;
- }
- }
- }
- }
-
- throw (Exception)var8;
- }
-
- private synchronized RemoteRef getRef() throws RemoteException {
- if (this.ref == null) {
- this.ref = this.activate(false);
- }
-
- return this.ref;
- }
-
- private RemoteRef activate(boolean var1) throws RemoteException {
- this.ref = null;
-
- try {
- ActivatableRef var2 = (ActivatableRef)((RemoteStub)this.field_0.activate(var1)).getRef();
- this.ref = var2.ref;
- return this.ref;
- } catch (RemoteException var5) {
- throw var5;
- } catch (UnknownObjectException var6) {
- throw new NoSuchObjectException("activatable object no longer registered");
- } catch (Exception var7) {
- throw new ActivateFailedException("failed to activate object", var7);
- }
- }
-
- public synchronized RemoteCall newCall(RemoteObject var1, Operation[] var2, int var3, long var4) throws RemoteException {
- throw new UnsupportedOperationException("activation requires 1.2 stubs");
- }
-
- public void invoke(RemoteCall var1) throws Exception {
- throw new UnsupportedOperationException("activation requires 1.2 stubs");
- }
-
- public void done(RemoteCall var1) throws RemoteException {
- throw new UnsupportedOperationException("activation requires 1.2 stubs");
- }
-
- public String getRefClass(ObjectOutput var1) {
- return "ActivatableRef";
- }
-
- public void writeExternal(ObjectOutput var1) throws IOException {
- RemoteRef var2 = this.ref;
- var1.writeObject(this.field_0);
- if (var2 == null) {
- var1.writeUTF("");
- } else {
- var1.writeUTF(var2.getRefClass(var1));
- var2.writeExternal(var1);
- }
-
- }
-
- public void readExternal(ObjectInput var1) throws IOException, ClassNotFoundException {
- this.field_0 = (ActivationID)var1.readObject();
- this.ref = null;
- String var2 = var1.readUTF();
- if (!var2.equals("")) {
- try {
- Class var3 = Class.forName("sun.rmi.server." + var2);
- this.ref = (RemoteRef)var3.newInstance();
- this.ref.readExternal(var1);
- } catch (InstantiationException var5) {
- throw new UnmarshalException("Unable to create remote reference", var5);
- } catch (IllegalAccessException var6) {
- throw new UnmarshalException("Illegal access creating remote reference");
- }
- }
- }
-
- public String remoteToString() {
- return "RemoteStub [ref: " + this.ref + "]";
- }
-
- public int remoteHashCode() {
- return this.field_0.hashCode();
- }
-
- public boolean remoteEquals(RemoteRef var1) {
- return var1 instanceof ActivatableRef ? this.field_0.equals(((ActivatableRef)var1).field_0) : false;
- }
- }
-