예제 #1
1
 @Override
 public void serialize(DataOutput out) throws IOException {
   // little endian
   for (long w : bitmap) {
     out.writeLong(Long.reverseBytes(w));
   }
 }
 @Override
 public void write(DataOutput out) throws IOException {
   out.writeInt(set.size());
   for (long l : set) {
     out.writeLong(l);
   }
 }
예제 #3
0
 public void write(DataOutput out) throws IOException {
   if (activeTrackers.size() == 0) {
     out.writeInt(numActiveTrackers);
     out.writeInt(0);
   } else {
     out.writeInt(activeTrackers.size());
     out.writeInt(activeTrackers.size());
     for (String tracker : activeTrackers) {
       Text.writeString(out, tracker);
     }
   }
   if (blacklistedTrackersInfo.size() == 0) {
     out.writeInt(numBlacklistedTrackers);
     out.writeInt(blacklistedTrackersInfo.size());
   } else {
     out.writeInt(blacklistedTrackersInfo.size());
     out.writeInt(blacklistedTrackersInfo.size());
     for (BlackListInfo tracker : blacklistedTrackersInfo) {
       tracker.write(out);
     }
   }
   out.writeInt(numExcludedNodes);
   out.writeLong(ttExpiryInterval);
   out.writeInt(map_tasks);
   out.writeInt(reduce_tasks);
   out.writeInt(max_map_tasks);
   out.writeInt(max_reduce_tasks);
   out.writeLong(used_memory);
   out.writeLong(max_memory);
   WritableUtils.writeEnum(out, state);
 }
예제 #4
0
파일: RowId.java 프로젝트: tuan08/datatp
 public void write(DataOutput out) throws IOException {
   out.writeInt(key.length);
   out.write(key);
   out.writeLong(createdTime);
   out.writeLong(modifiedTime);
   out.writeByte(state);
 }
예제 #5
0
  public void serialize(final DataOutput output) {
    try {
      output.writeDouble(maxError);
      output.writeDouble(alpha);
      output.writeLong(landmarkInSeconds);
      output.writeLong(min);
      output.writeLong(max);
      output.writeInt(totalNodeCount);

      postOrderTraversal(
          root,
          new Callback() {
            @Override
            public boolean process(Node node) {
              try {
                serializeNode(output, node);
              } catch (IOException e) {
                Throwables.propagate(e);
              }
              return true;
            }
          });
    } catch (IOException e) {
      Throwables.propagate(e);
    }
  }
예제 #6
0
 // Used for internal Hadoop purposes.
 // Describes how to write this node across a network
 public void write(DataOutput out) throws IOException {
   out.writeLong(nodeid);
   out.writeDouble(pageRank);
   for (long n : outgoing) {
     out.writeLong(n);
   }
   out.writeLong(-1);
 }
예제 #7
0
    @Override
    public void writeTo(DataOutput out, ORecordVersion version) throws IOException {
      final ODistributedVersion distributedVersion = (ODistributedVersion) version;

      out.writeInt(distributedVersion.counter);
      out.writeLong(distributedVersion.timestamp);
      out.writeLong(distributedVersion.macAddress);
    }
예제 #8
0
 public void write(DataOutput out) throws IOException {
   out.writeLong(userid);
   out.writeLong(start);
   out.writeLong(end);
   out.writeInt(nhits);
   out.writeInt(age);
   out.writeInt(isMale);
 }
예제 #9
0
 public void writeTo(DataOutput out) throws Exception {
   out.writeInt(status);
   Bits.writeString(classname, out);
   Bits.writeString(name, out);
   out.writeLong(start_time);
   out.writeLong(stop_time);
   Bits.writeString(failure_type, out);
   Bits.writeString(failure_msg, out);
   Bits.writeString(stack_trace, out);
 }
  /**
   * This method writes this object of <code>ApplicationStateDetails</code> to the specified output
   * stream object.
   *
   * @param out DataOutput object
   * @param versionNo
   * @throws IOException if an error occurs while converting data and writing it to a binary stream.
   * @since Tifosi2.0
   */
  public void toStream(DataOutput out, int versionNo) throws IOException {
    super.toStream(out, versionNo);

    out.writeLong(m_launchTime);
    out.writeLong(m_killTime);
    writeUTF(out, m_strAppGUID);
    writeUTF(out, m_strAppVersion);
    out.writeInt(m_serviceStates.size());

    Enumeration enums = m_serviceStates.keys();

    while (enums.hasMoreElements()) {
      String instName = (String) enums.nextElement();
      ServiceInstanceStateDetails status =
          (ServiceInstanceStateDetails) m_serviceStates.get(instName);

      UTFReaderWriter.writeUTF(out, instName);
      status.toStream(out, versionNo);
    }

    out.writeInt(m_serviceExceptionTraces.size());

    Enumeration traceEnums = m_serviceExceptionTraces.keys();

    while (traceEnums.hasMoreElements()) {
      String instName = (String) traceEnums.nextElement();
      String trace = (String) m_serviceExceptionTraces.get(instName);

      UTFReaderWriter.writeUTF(out, instName);
      UTFReaderWriter.writeUTF(out, trace);
    }

    out.writeInt(m_debugRoutes.size());
    Iterator debugRoutes = getDebugRoutes();

    while (debugRoutes.hasNext()) {
      String routeGUID = (String) debugRoutes.next();
      UTFReaderWriter.writeUTF(out, routeGUID);
    }

    out.writeInt(m_pendingDebugRoutesForClosure.size());
    Iterator pendingDebugRoutesForClosure = getPendingDebugRoutesForClosure();

    while (pendingDebugRoutesForClosure.hasNext()) {
      String routeGUID = (String) pendingDebugRoutesForClosure.next();
      UTFReaderWriter.writeUTF(out, routeGUID);
    }

    out.writeInt(m_previousSyncPeers.size());
    Iterator previousSynchPeers = getPreviousSynchPeers();
    while (previousSynchPeers.hasNext()) {
      String peerName = (String) previousSynchPeers.next();
      UTFReaderWriter.writeUTF(out, peerName);
    }
  }
예제 #11
0
 @Override
 public void write(DataOutput out) throws IOException {
   out.writeInt(id);
   out.writeLong(getNumObservations());
   out.writeLong(getTotalObservations());
   VectorWritable.writeVector(out, getCenter());
   VectorWritable.writeVector(out, getRadius());
   out.writeDouble(s0);
   VectorWritable.writeVector(out, s1);
   VectorWritable.writeVector(out, s2);
 }
  /*
   * NOTE:  This implementation assumes a maximum of 64 capability
   * bits per node class.  If this changes in the future, this
   * implementation will need to be updated.
   */
  private void writeCapabilities(DataOutput out) throws IOException {
    long capabilities = 0;
    long frequentCapabilities = 0;

    for (int i = 0; i < 64; i++) {
      if (node.getCapability(i)) capabilities |= (1L << i);
      if (!(node.getCapabilityIsFrequent(i))) frequentCapabilities |= (1L << i);
    }
    out.writeLong(capabilities);
    out.writeLong(frequentCapabilities);
  }
예제 #13
0
 @Override
 public void write(DataOutput out) throws IOException {
   Text text = new Text();
   text.set(this.jobId);
   text.write(out);
   text.set(this.taskId);
   text.write(out);
   out.writeLong(this.startTime);
   out.writeLong(this.endTime);
   out.writeLong(this.duration);
   super.write(out);
 }
예제 #14
0
 @SuppressWarnings("deprecation")
 public void write(DataOutput out) throws IOException {
   out.writeLong(rpcVersion);
   UTF8.writeString(out, declaringClassProtocolName);
   UTF8.writeString(out, methodName);
   out.writeLong(clientVersion);
   out.writeInt(clientMethodsHash);
   out.writeInt(parameterClasses.length);
   for (int i = 0; i < parameterClasses.length; i++) {
     ObjectWritable.writeObject(out, parameters[i], parameterClasses[i], conf, true);
   }
 }
예제 #15
0
 //////////////////////////////////////////////////
 // Writable
 //////////////////////////////////////////////////
 public void write(DataOutput out) throws IOException {
   out.writeInt(path.length);
   out.write(path);
   out.writeLong(length);
   out.writeBoolean(isdir);
   out.writeShort(block_replication);
   out.writeLong(blocksize);
   out.writeLong(modification_time);
   out.writeLong(access_time);
   permission.write(out);
   Text.writeStringOpt(out, owner);
   Text.writeStringOpt(out, group);
 }
예제 #16
0
 @Override
 public boolean solve(final Object solver, long res) {
   if ((res < (1L << 52)) && (solver != null)) {
     {
       final IDMap<Object> solvers = MappedDatabase.this.solvers;
       final int sid;
       synchronized (solvers) {
         if (solvers.containsKey(solver)) sid = solvers.get(solver);
         else {
           sid = solvers.map(solver);
           final LocalDateTime now = LocalDateTime.now();
           solverLog.printf(
               "%04d-%02d-%02d %02d:%02d SOLVER #%4d: %s\n",
               now.getYear(),
               now.getMonthValue(),
               now.getDayOfMonth(),
               now.getHour(),
               now.getMinute(),
               sid,
               solver);
         }
       }
       res |= (long) sid << 52;
     }
     final long spec = (getSpec() << 20) | timestamp(LocalDateTime.now());
     final LongBuffer db = MappedDatabase.this.db;
     final int idx = this.idx;
     synchronized (db) {
       if (((db.get(idx) ^ spec) >> 20) == 0L) {
         if (db.get(idx + 1) == 0L) {
           db.put(idx, spec);
           db.put(idx + 1, res);
         } else {
           final DataOutput dupStream = MappedDatabase.this.dupStream;
           if (dupStream != null) {
             try {
               dupStream.writeLong(spec);
               dupStream.writeLong(res);
             } catch (final Exception e) {
               System.err.printf(
                   "Duplicate result: %010X: %013X by %s\n", spec >>> 25, res, solver);
             }
           }
         }
         return true;
       }
     }
   }
   System.err.printf("Result report error: %010X: %013X by %s\n", getSpec() >>> 5, res, solver);
   return false;
 } // solve()
 /**
  * @throws IllegalStateException if off-heap and the actual value is not yet known (because the
  *     DistributedSystem has not yet been created)
  */
 public void toData(DataOutput out) throws IOException {
   checkLocalMaxMemoryExists();
   out.writeInt(this.redundancy);
   out.writeLong(this.totalMaxMemory);
   out.writeInt(
       getLocalMaxMemory()); // call the gettor to force it to be computed in the offheap case
   out.writeInt(this.totalNumBuckets);
   DataSerializer.writeString(this.colocatedRegionName, out);
   DataSerializer.writeObject(this.localProperties, out);
   DataSerializer.writeObject(this.globalProperties, out);
   out.writeLong(this.recoveryDelay);
   out.writeLong(this.startupRecoveryDelay);
   DataSerializer.writeObject(this.fixedPAttrs, out);
 }
 @Override
 public void write(DataOutput out) throws IOException {
   out.writeLong(this.token.getMostSignificantBits());
   out.writeLong(this.token.getLeastSignificantBits());
   out.writeInt(this.version);
   if (getLastUpdateLocation() != null) {
     out.writeBoolean(true);
     LocationMarshaller.INSTANCE.writePayload(getLastUpdateLocation(), out);
   } else {
     out.writeBoolean(false);
   }
   out.writeLong(this.storedSchedulers.getPageId());
   out.writeLong(this.journalRC.getPageId());
   out.writeLong(this.removeLocationTracker.getPageId());
 }
예제 #19
0
 public void writePayload(SequenceSet value, DataOutput out) throws IOException {
   out.writeInt(value.size());
   Sequence sequence = value.getHead();
   while (sequence != null) {
     if (sequence.range() > 1) {
       out.writeBoolean(true);
       out.writeLong(sequence.first);
       out.writeLong(sequence.last);
     } else {
       out.writeBoolean(false);
       out.writeLong(sequence.first);
     }
     sequence = sequence.getNext();
   }
 }
예제 #20
0
 public void write(final DataOutput out) throws IOException {
   out.writeByte(DELETE_VERSION);
   Bytes.writeByteArray(out, this.row);
   out.writeLong(this.ts);
   out.writeLong(this.lockId);
   out.writeInt(familyMap.size());
   for (Map.Entry<byte[], List<KeyValue>> entry : familyMap.entrySet()) {
     Bytes.writeByteArray(out, entry.getKey());
     List<KeyValue> list = entry.getValue();
     out.writeInt(list.size());
     for (KeyValue kv : list) {
       kv.write(out);
     }
   }
 }
예제 #21
0
  public void save(final DataOutput out) {
    super.save(out);
    myType.save(out);

    try {
      if (myValue instanceof String) {
        out.writeByte(STRING);
        String value = (String) myValue;
        RW.writeUTF(out, value);
      } else if (myValue instanceof Integer) {
        out.writeByte(INTEGER);
        DataInputOutputUtil.writeINT(out, ((Integer) myValue).intValue());
      } else if (myValue instanceof Long) {
        out.writeByte(LONG);
        out.writeLong(((Long) myValue).longValue());
      } else if (myValue instanceof Float) {
        out.writeByte(FLOAT);
        out.writeFloat(((Float) myValue).floatValue());
      } else if (myValue instanceof Double) {
        out.writeByte(DOUBLE);
        out.writeDouble(((Double) myValue).doubleValue());
      } else if (myValue instanceof Type) {
        out.writeByte(TYPE);
        RW.writeUTF(out, ((Type) myValue).getDescriptor());
      } else {
        out.writeByte(NONE);
      }
    } catch (IOException e) {
      throw new BuildDataCorruptedException(e);
    }
  }
예제 #22
0
 @Override
 public void write(DataOutput dataOutput) throws IOException {
   dataOutput.writeLong(leftCoordinate);
   Text.writeString(dataOutput, samRecord);
   Text.writeString(dataOutput, rfname);
   // Text.writeString(dataOutput, sqTag);
 }
예제 #23
0
파일: Locking.java 프로젝트: an1310/JGroups
 public void writeTo(DataOutput out) throws Exception {
   out.writeByte(type.ordinal());
   Util.writeString(lock_name, out);
   Util.writeStreamable(owner, out);
   out.writeLong(timeout);
   out.writeBoolean(is_trylock);
 }
예제 #24
0
 /**
  * write.
  *
  * @param out output stream
  * @throws IOException -
  */
 @Override
 public void write(final DataOutput out) throws IOException {
   out.writeInt(this.relatedUsers.size());
   for (LongWritable item : this.relatedUsers) {
     out.writeLong(item.get());
   }
 }
예제 #25
0
 public void writeLong(long v) {
   try {
     dataOutput.writeLong(v);
   } catch (IOException ex) {
     throw new RuntimeException(ex.getMessage());
   }
 }
 @Override
 public void write(DataOutput out) throws IOException {
   super.write(out);
   out.writeLong(myTimestamp);
   out.writeBoolean(isReadOnly);
   myContent.write(out);
 }
예제 #27
0
  @Override
  public void marshall(
      Object value, Class<?> type, DataOutput dataOutput, SerializationContext serializationContext)
      throws IOException {
    writePossibleNull(value, dataOutput);

    Map<?, ?> map = (Map<?, ?>) value;
    dataOutput.writeInt(map.size());
    for (Entry<?, ?> entry : map.entrySet()) {
      Marshaller keyMarshaller;
      Marshaller valueMarshaller;
      if (mapKeyType != null) {
        ensureMarshallersInitialized(serializationContext);
        keyMarshaller = mapKeyTypeMarshaller;
        valueMarshaller = mapValueTypeMarshaller;
      } else {
        keyMarshaller =
            entry.getKey() != null
                ? serializationContext.findMarshaller(entry.getKey().getClass())
                : null;
        valueMarshaller =
            entry.getValue() != null
                ? serializationContext.findMarshaller(entry.getValue().getClass())
                : null;
      }

      if (writePossibleNull(entry.getKey(), dataOutput)) {
        ClassDefinition keyClassDefinition =
            serializationContext
                .getClassDefinitionContainer()
                .getClassDefinitionByType(entry.getKey().getClass());
        dataOutput.writeLong(keyClassDefinition.getId());
        keyMarshaller.marshall(
            entry.getKey(), entry.getKey().getClass(), dataOutput, serializationContext);
      }

      if (writePossibleNull(entry.getValue(), dataOutput)) {
        ClassDefinition valueClassDefinition =
            serializationContext
                .getClassDefinitionContainer()
                .getClassDefinitionByType(entry.getValue().getClass());
        dataOutput.writeLong(valueClassDefinition.getId());
        valueMarshaller.marshall(
            entry.getValue(), entry.getValue().getClass(), dataOutput, serializationContext);
      }
    }
  }
예제 #28
0
 public void serialize(IndexSummary t, DataOutput out) throws IOException {
   out.writeInt(DatabaseDescriptor.getIndexInterval());
   out.writeInt(t.keys.length);
   for (int i = 0; i < t.keys.length; i++) {
     out.writeLong(t.getPosition(i));
     ByteBufferUtil.writeWithLength(t.keys[i], out);
   }
 }
 //////////////////////////////////////////////////
 // Writable
 //////////////////////////////////////////////////
 @Override
 public void write(DataOutput out) throws IOException {
   Text.writeString(out, getPath().toString(), Text.DEFAULT_MAX_LEN);
   out.writeLong(getLen());
   out.writeBoolean(isDirectory());
   out.writeShort(getReplication());
   out.writeLong(getBlockSize());
   out.writeLong(getModificationTime());
   out.writeLong(getAccessTime());
   getPermission().write(out);
   Text.writeString(out, getOwner(), Text.DEFAULT_MAX_LEN);
   Text.writeString(out, getGroup(), Text.DEFAULT_MAX_LEN);
   out.writeBoolean(isSymlink());
   if (isSymlink()) {
     Text.writeString(out, getSymlink().toString(), Text.DEFAULT_MAX_LEN);
   }
 }
 @Override
 public void write(DataOutput out) throws IOException {
   out.writeLong(length);
   out.writeInt(indexDirs.size());
   for (Path p : indexDirs) {
     Text.writeString(out, p.toString());
   }
 }