Ejemplo n.º 1
0
  public void write(ObjectOutput out, boolean useNewFormat) throws IOException {
    boolean isResultStream = false;
    if (out instanceof ConnectionOutputStream) {
      ConnectionOutputStream stream = (ConnectionOutputStream) out;
      isResultStream = stream.isResultStream();
      /*
       * If this LiveRef is being marshalled as part of a return value,
       * then we have to worry about referential integrity being broken
       * while the reference is in transit, in case there no longer
       * remains a strong reference in this VM after the call has
       * completed.  Therefore, we tell the stream to save a reference
       * until an acknowledgment has been received from the caller; for
       * "local" LiveRefs, save a reference to the impl directly,
       * because the impl is not reachable from this LiveRef (see
       * 4114579); otherwise, save a reference to the LiveRef, for the
       * client-side DGC to watch over (see 4017232 for more details).
       */
      if (isResultStream) {
        if (isLocal) {
          Target target = ObjectTable.getTarget(id);
          if (target != null) {
            Remote impl = target.getImpl();
            if (impl != null) {
              stream.saveObject(impl);
            }
          }
        } else {
          stream.saveObject(this);
        }
      }
    }
    // All together now write out the endpoint, id, and flag

    // (need to choose whether or not to use old JDK1.1 endpoint format)
    if (useNewFormat) {
      ((TCPEndpoint) ep).write(out);
    } else {
      ((TCPEndpoint) ep).writeHostPortFormat(out);
    }
    id.write(out);
    out.writeBoolean(isResultStream);
  }
Ejemplo n.º 2
0
 protected void marshalCustomCallData(ObjectOutput out) throws IOException {
   // this custom data ensures that a custom server
   // ref has written the relevant information.
   System.err.println("marshalling call data...");
   out.writeObject("hello there.");
 }