com.alibaba.datax.common.element.Record.getMemorySize()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中com.alibaba.datax.common.element.Record.getMemorySize方法的一些代码示例,展示了Record.getMemorySize的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.getMemorySize方法的具体详情如下:
包路径:com.alibaba.datax.common.element.Record
类名称:Record
方法名:getMemorySize

Record.getMemorySize介绍

暂无

代码示例

代码示例来源:origin: ECNU-1X/DataX-Masking

private int getRecordBytes(Collection<Record> rs){
  int bytes = 0;
  for(Record r : rs){
    bytes += r.getMemorySize();
  }
  return bytes;
}

代码示例来源:origin: ECNU-1X/DataX-Masking

@Override
protected void doPush(Record r) {
  try {
    long startTime = System.nanoTime();
    this.queue.put(r);
    waitWriterTime += System.nanoTime() - startTime;
    memoryBytes.addAndGet(r.getMemorySize());
  } catch (InterruptedException ex) {
    Thread.currentThread().interrupt();
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

@Override
protected Record doPull() {
  try {
    long startTime = System.nanoTime();
    Record r = this.queue.take();
    waitReaderTime += System.nanoTime() - startTime;
    memoryBytes.addAndGet(-r.getMemorySize());
    return r;
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: ECNU-1X/DataX-Masking

@Override
public void sendToWriter(Record record) {
  if(shutdown){
    throw DataXException.asDataXException(CommonErrorCode.SHUT_DOWN_TASK, "");
  }
  Validate.notNull(record, "record不能为空.");
  if (record.getMemorySize() > this.byteCapacity) {
    this.pluginCollector.collectDirtyRecord(record, new Exception(String.format("单条记录超过大小限制,当前限制为:%s", this.byteCapacity)));
    return;
  }
  boolean isFull = (this.bufferIndex >= this.bufferSize || this.memoryBytes.get() + record.getMemorySize() > this.byteCapacity);
  if (isFull) {
    flush();
  }
  this.buffer.add(record);
  this.bufferIndex++;
  memoryBytes.addAndGet(record.getMemorySize());
}

代码示例来源:origin: ECNU-1X/DataX-Masking

@Override
public void sendToWriter(Record record) {
  if (shutdown) {
    throw DataXException.asDataXException(CommonErrorCode.SHUT_DOWN_TASK, "");
  }
  Validate.notNull(record, "record不能为空.");
  record = doTransformer(record);
  if(record == null){
    return;
  }
  if (record.getMemorySize() > this.byteCapacity) {
    this.pluginCollector.collectDirtyRecord(record, new Exception(String.format("单条记录超过大小限制,当前限制为:%s", this.byteCapacity)));
    return;
  }
  boolean isFull = (this.bufferIndex >= this.bufferSize || this.memoryBytes.get() + record.getMemorySize() > this.byteCapacity);
  if (isFull) {
    flush();
  }
  this.buffer.add(record);
  this.bufferIndex++;
  memoryBytes.addAndGet(record.getMemorySize());
}

代码示例来源:origin: ECNU-1X/DataX-Masking

bufferBytes += record.getMemorySize();

相关文章