// Generated code, do not modify

package run;


/** Stub class for remote class 'run.Worker_class_impl' */
public   class Worker_class_impl_KStub extends jp.lang.RemoteObject_class_impl_KStub
  implements uka.patch.PatchableRoot, uka.karmi.rmi.Remote, jp.lang.RemoteObject_class_intf, run.Worker_class_intf
{
  /** Explicitly defined default constructor is necessary
      if uka.transport is used. */
  public Worker_class_impl_KStub() {
    super();
  }

  /** Smart stubs reuse the stub of the servers super class. The first
      method identifier can not be computed at class loading time, 
      because a compile time constant is needed in switch statements. */
  private static final int ID_FIRSTMETHOD = jp.lang.RemoteObject_class_impl_KStub.ID_LASTMETHOD + 1;

  static { 
    if (ID_FIRSTMETHOD != jp.lang.RemoteObject_class_impl_KStub._KARMI_getLastMethodID() + 1) {
      // The compile time constants differ from the constant at class
      // loading time. This is an error due to incomplete separate
      // compilation
      throw new InternalError(
        "Separate compilation problem: Please recompile " +
        "class 'run.Worker_class_impl' and all its subclasses."
      );
    }
  }

  /** Method identifier for method run_Worker__class_get_() */
  public static final int ID_run_Worker__class_get_$ = ID_FIRSTMETHOD + 0;

  public run.Worker_class_intf run_Worker__class_get_() throws uka.karmi.rmi.RemoteException {
    if (remoteServer != null) {
      // short cut: call server implementation directly
      return (run.Worker_class_intf) uka.karmi.rmi.ExportPoint.toStub(((run.Worker_class_impl) remoteServer).run_Worker__class_get_());
    } else {
      uka.karmi.rmi.ClientConnection _c = remoteClientRef.getContext(run.Worker_class_impl_KStub.ID_run_Worker__class_get_$);

      Throwable resultex;
      try {
        _c.openSendCall();
        _c.closeSendCall();

        boolean _normalReturn = _c.openReceiveResult();
        try {
          if (_normalReturn) {
            return (run.Worker_class_intf) _c.receiveObject();
          } else {
            resultex = (Throwable) _c.receiveObject();
          }
        } finally {
          _c.closeReceiveResult();
        }
      } catch (ClassNotFoundException ex) {
        _c.closeExceptionally();
        throw new uka.karmi.rmi.RemoteException("KaRMI: unmarshal problem", ex);
      } catch (uka.karmi.rmi.RemoteException ex) {
        _c.closeExceptionally();
        throw ex;
      } catch (java.io.IOException ex) {
        _c.closeExceptionally();
        throw new uka.karmi.rmi.RemoteException("KaRMI: transport problem", ex);
      } catch (RuntimeException ex) {
        _c.closeExceptionally();
        throw ex;
      } catch (Error ex) {
        _c.closeExceptionally();
        throw ex;
      }

      // rethrow runtime exceptions and declared exceptions
      if (resultex instanceof java.lang.Error) {
        throw (java.lang.Error) resultex;
      }
      if (resultex instanceof java.lang.RuntimeException) {
        throw (java.lang.RuntimeException) resultex;
      }
      // exception not possible here
      throw new InternalError("KaRMI: exception not declared: " + resultex);
    }
  }

  /** Method identifier for method _new(jp.sync.Barrier p0, double p1, double p2, boolean p3) */
  public static final int ID__new$jp_sync_Barrier$double$double$boolean = ID_FIRSTMETHOD + 1;

  public java.lang.Object _new(jp.sync.Barrier p0, double p1, double p2, boolean p3) throws uka.karmi.rmi.RemoteException {
    if (remoteServer != null) {
      // short cut: call server implementation directly
      uka.karmi.rmi.CopyEnvironment _cenv = uka.karmi.rmi.Transport.getCopyEnvironment();
      try {
        return (java.lang.Object) _cenv.doDeepClone(((run.Worker_class_impl) remoteServer)._new((jp.sync.Barrier) _cenv.doDeepClone(p0), p1, p2, p3));
      } catch (CloneNotSupportedException ex) {
        throw new uka.karmi.rmi.RemoteException("KaRMIc: arg or result not clonable", ex);
      } finally {
        uka.karmi.rmi.Transport.putCopyEnvironment(_cenv);
      }
    } else {
      uka.karmi.rmi.ClientConnection _c = remoteClientRef.getContext(run.Worker_class_impl_KStub.ID__new$jp_sync_Barrier$double$double$boolean);

      Throwable resultex;
      try {
        _c.openSendCall();
        _c.openSendPrimitive(17);
        _c.sendDouble(p1);
        _c.sendDouble(p2);
        _c.sendBoolean(p3);
        _c.closeSendPrimitive(17);
        _c.sendObject(p0);
        _c.closeSendCall();

        boolean _normalReturn = _c.openReceiveResult();
        try {
          if (_normalReturn) {
            return (java.lang.Object) _c.receiveObject();
          } else {
            resultex = (Throwable) _c.receiveObject();
          }
        } finally {
          _c.closeReceiveResult();
        }
      } catch (ClassNotFoundException ex) {
        _c.closeExceptionally();
        throw new uka.karmi.rmi.RemoteException("KaRMI: unmarshal problem", ex);
      } catch (uka.karmi.rmi.RemoteException ex) {
        _c.closeExceptionally();
        throw ex;
      } catch (java.io.IOException ex) {
        _c.closeExceptionally();
        throw new uka.karmi.rmi.RemoteException("KaRMI: transport problem", ex);
      } catch (RuntimeException ex) {
        _c.closeExceptionally();
        throw ex;
      } catch (Error ex) {
        _c.closeExceptionally();
        throw ex;
      }

      // rethrow runtime exceptions and declared exceptions
      if (resultex instanceof uka.karmi.rmi.RemoteException) {
        throw (uka.karmi.rmi.RemoteException) resultex;
      }
      if (resultex instanceof java.lang.Error) {
        throw (java.lang.Error) resultex;
      }
      if (resultex instanceof java.lang.RuntimeException) {
        throw (java.lang.RuntimeException) resultex;
      }
      // exception not possible here
      throw new InternalError("KaRMI: exception not declared: " + resultex);
    }
  }

  /** Export the last method id to subclasses of 
      this stub class to produce unique method ids
      within a branch of the class hierarchy. */
  protected static final int ID_LASTMETHOD = ID__new$jp_sync_Barrier$double$double$boolean;

  /** Allow check for separate compilation problems 
      at class loading time. */
  protected static int _KARMI_getLastMethodID() {
    return ID_LASTMETHOD;
  }

  /**
   * Transport descriptor for class Worker_class_impl_KStub.
   */
  public static final uka.transport.TransportDescriptor TRANSPORT_DESCRIPTOR =
    new uka.transport.TransportDescriptor() {
      public Object unmarshalReference(uka.transport.UnmarshalStream s, int id)
        throws java.io.IOException, ClassNotFoundException
      {
        return new Worker_class_impl_KStub(s, id);
      }

      public boolean unmarshal(Object obj, uka.transport.UnmarshalStream s)
        throws ClassNotFoundException, java.io.IOException
      {
        ((Worker_class_impl_KStub) obj).unmarshal(s);
        return true;
      }

      public void marshalReference(Object obj, uka.transport.MarshalStream s)
        throws java.io.IOException
      {
        ((Worker_class_impl_KStub) obj).marshalReference(s);
      }

      public void marshal(Object obj, uka.transport.MarshalStream s)
        throws java.io.IOException
      {
        ((Worker_class_impl_KStub) obj).marshal(s);
      }

      public Object deepClone(Object orig, int id, uka.transport.DeepClone _helper)
        throws CloneNotSupportedException
      {
        return orig;
      }

      public boolean deepCloneReferences(Object orig, Object copy, uka.transport.DeepClone _helper)
        throws CloneNotSupportedException
      {
        return false;
      }

      public void restoreAfterUnmarshal(Object obj)
        throws ClassNotFoundException, java.io.IOException
      {
        ((Worker_class_impl_KStub) obj).externalRestoreAfterUnmarshal();
      }

      public Class getType() {
        return Worker_class_impl_KStub.class;
      }
    };

  public uka.transport.TransportDescriptor getTransportDescriptor() {
    return TRANSPORT_DESCRIPTOR;
  }

  /**
   * Called from uka.transport.UnmarshalStream to create
   * a transportable object.
   */
  public Worker_class_impl_KStub(uka.transport.UnmarshalStream _stream, int _id)
    throws java.io.IOException, ClassNotFoundException
  {
    super(_stream, _id);
  }

}
