Exemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    boolean done;
    boolean cancelled;
    Object res;
    Throwable err;
    boolean syncNotify;
    boolean concurNotify;

    synchronized (mux) {
      done = this.done;
      cancelled = this.cancelled;
      res = this.res;
      err = this.err;
      syncNotify = this.syncNotify;
      concurNotify = this.concurNotify;
    }

    out.writeBoolean(done);
    out.writeBoolean(syncNotify);
    out.writeBoolean(concurNotify);

    // Don't write any further if not done, as deserialized future
    // will be invalid anyways.
    if (done) {
      out.writeBoolean(cancelled);
      out.writeObject(res);
      out.writeObject(err);
    }
  }
Exemplo n.º 2
0
  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(descColumns != null);
    if (descColumns != null) {
      out.writeInt(descColumns.length);
      for (int i = 0; i < descColumns.length; i++) out.writeBoolean(descColumns[i]);
    }

    out.writeBoolean(nullsOrderedLow != null);
    if (nullsOrderedLow != null) {
      out.writeInt(nullsOrderedLow.length);
      for (int i = 0; i < nullsOrderedLow.length; i++) out.writeBoolean(nullsOrderedLow[i]);
    }
  }
Exemplo n.º 3
0
  private void writeTo(ObjectOutput o) throws IOException {
    o.writeInt(x);
    o.writeInt(y);
    o.writeInt(width);
    o.writeInt(height);
    o.writeInt(measuredWidth);
    o.writeInt(measuredHeight);
    o.writeInt(scrollX);
    o.writeInt(scrollY);
    o.writeInt(absoluteX);
    o.writeInt(absoluteY);
    o.writeFloat(cameraDistance);
    o.writeBoolean(visible);
    o.writeLong(drawingTime);
    o.writeBoolean(isShown);
    o.writeBoolean(hasFocus);
    o.writeBoolean(focusable);
    o.writeBoolean(hasOnClickListener);
    o.writeObject(viewType);
    o.writeObject(textContent);
    o.writeBoolean(isEditText);
    o.writeBoolean(isInputMethodTarget);
    o.writeBoolean(isContainer);
    o.writeInt(inputMethod);
    o.writeInt(id);

    if (children != null) {
      o.writeInt(children.size());
      for (ViewComponentInfo child : children) {
        child.writeTo(o);
      }
    } else {
      o.writeInt(0);
    }
  }
  /** {@inheritDoc} */
  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);

    out.writeLong(threadId);
    out.writeBoolean(commit);
    out.writeBoolean(invalidate);
    out.writeBoolean(reply);

    U.writeGridUuid(out, futId);
    CU.writeVersion(out, commitVer);
    CU.writeVersion(out, baseVer);

    U.writeCollection(out, writeEntries);
  }
  private static void writeOnPrimitive(
      final ObjectOutput out, final Object obj, final ClassMetadataField metaField)
      throws IOException {

    try {
      final Field field = metaField.getField();
      final Class clazz = field.getType();
      if (clazz == Integer.TYPE) {
        out.writeInt(FieldsManager.getFieldsManager().getInt(obj, metaField));
      } else if (clazz == Byte.TYPE) {
        out.writeByte(FieldsManager.getFieldsManager().getByte(obj, metaField));
      } else if (clazz == Long.TYPE) {
        out.writeLong(FieldsManager.getFieldsManager().getLong(obj, metaField));
      } else if (clazz == Float.TYPE) {
        out.writeFloat(FieldsManager.getFieldsManager().getFloat(obj, metaField));
      } else if (clazz == Double.TYPE) {
        out.writeDouble(FieldsManager.getFieldsManager().getDouble(obj, metaField));
      } else if (clazz == Short.TYPE) {
        out.writeShort(FieldsManager.getFieldsManager().getShort(obj, metaField));
      } else if (clazz == Character.TYPE) {
        out.writeChar(field.getChar(obj));
      } else if (clazz == Boolean.TYPE) {
        out.writeBoolean(field.getBoolean(obj));
      } else {
        throw new RuntimeException("Unexpected datatype " + clazz.getName());
      }
    } catch (IllegalAccessException access) {
      IOException io = new IOException(access.getMessage());
      io.initCause(access);
      throw io;
    }
  }
  /** {@inheritDoc} */
  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);

    out.writeLong(topVer);
    out.writeBoolean(implicitTx);
    out.writeBoolean(implicitSingleTx);
    out.writeBoolean(syncCommit);
    out.writeBoolean(syncRollback);
    out.writeObject(filterBytes);

    U.writeArray(out, dhtVers);

    assert miniId != null;

    U.writeGridUuid(out, miniId);
  }
Exemplo n.º 7
0
  /** {@inheritDoc} */
  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    U.writeString(out, jobName);
    U.writeString(out, user);

    out.writeBoolean(hasCombiner);
    out.writeInt(numReduces);

    U.writeStringMap(out, props);
  }
Exemplo n.º 8
0
  /** {@inheritDoc} */
  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(depEnabled);

    if (depEnabled) {
      U.writeByteArray(out, topicBytes);
      U.writeByteArray(out, predBytes);
      U.writeString(out, clsName);
      out.writeObject(depInfo);
    } else {
      out.writeObject(topic);
      out.writeObject(pred);
    }
  }
Exemplo n.º 9
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);
  }
 /** {@inheritDoc} */
 @Override
 public void writeExternal(ObjectOutput out) throws IOException {
   out.writeInt(cnt);
   out.writeInt(initCnt);
   out.writeBoolean(autoDel);
 }