Example usage for org.apache.hadoop.hdfs.protocol.datatransfer PacketHeader PKT_MAX_HEADER_LEN

List of usage examples for org.apache.hadoop.hdfs.protocol.datatransfer PacketHeader PKT_MAX_HEADER_LEN

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol.datatransfer PacketHeader PKT_MAX_HEADER_LEN.

Prototype

int PKT_MAX_HEADER_LEN

To view the source code for org.apache.hadoop.hdfs.protocol.datatransfer PacketHeader PKT_MAX_HEADER_LEN.

Click Source Link

Usage

From source file:com.mellanox.r4h.DFSOutputStream.java

License:Apache License

/** Use {@link ByteArrayManager} to create buffer for non-heartbeat packets.*/
private DFSPacket createPacket(int packetSize, int chunksPerPkt, long offsetInBlock, long seqno,
        boolean lastPacketInBlock) throws InterruptedIOException {
    Msg newMsg = DFSOutputStream.this.getMsg();
    final int bufferSize = PacketHeader.PKT_MAX_HEADER_LEN + packetSize;
    return new DFSPacket(newMsg, chunksPerPkt, offsetInBlock, seqno, getChecksumSize(), lastPacketInBlock);
}

From source file:com.mellanox.r4h.DFSOutputStream.java

License:Apache License

private void computePacketChunkSize(int psize, int csize) {
    final int bodySize = psize - PacketHeader.PKT_MAX_HEADER_LEN;
    final int chunkSize = csize + getChecksumSize();
    chunksPerPacket = Math.max(bodySize / chunkSize, 1);
    packetSize = chunkSize * chunksPerPacket;
    if (DFSClient.LOG.isDebugEnabled()) {
        DFSClient.LOG.debug("computePacketChunkSize: src=" + src + ", chunkSize=" + chunkSize
                + ", chunksPerPacket=" + chunksPerPacket + ", packetSize=" + packetSize);
    }/*from w ww . j av  a2 s. co m*/
}