UnicastServerRef sref = null; if (obj instanceof RemoteObject) sref = (UnicastServerRef) ((RemoteObject) obj).getRef();  if (sref == null)
ActivatableServerRef sref = null;
  public static Remote export(ActivationID id, Remote obj, int port,                              RMIServerSocketFactory serverSocketFactory)      throws RemoteException  {    UnicastServerRef sref = null;    if (obj instanceof RemoteObject)      sref = (UnicastServerRef) ((RemoteObject) obj).getRef();    if (sref == null)      sref = new ActivatableServerRef(makeId(id), id, port, serverSocketFactory);    Remote stub = sref.exportObject(obj);    // addStub(obj, stub); // need probably the stub repository elsewhere    return stub;  }  