Search in sources :

Example 1 with FragHeader

use of org.jgroups.protocols.FragHeader in project geode by apache.

the class StatRecorder method filter.

private void filter(Message msg, int direction) {
    if (direction == INCOMING) {
        Header h = msg.getHeader(frag2HeaderId);
        boolean copyBuffer = false;
        if (h != null && h instanceof FragHeader) {
            copyBuffer = true;
        // String str = direction == OUTGOING? "sending" : "receiving";
        // logger.debug("{} fragment {} msg buffer hash {} offset {} msg size {} first bytes=\n{}",
        // str, hdr,
        // msg.getRawBuffer().hashCode(), msg.getOffset(), msg.getLength(),
        // GMSUtil.formatBytes(msg.getRawBuffer(), msg.getOffset(),
        // Math.min(200, msg.getLength())));
        } else {
            h = msg.getHeader(unicastHeaderId);
            if (h instanceof UNICAST3.Header) {
                copyBuffer = true;
            } else {
                h = msg.getHeader(nakackHeaderId);
                if (h instanceof NakAckHeader2) {
                    copyBuffer = true;
                }
            }
        }
        if (copyBuffer) {
            // JGroups doesn't copy its message buffer when thread pools are
            // disabled. This causes Frag2 fragments to become corrupted
            msg.setBuffer(msg.getBuffer(), 0, msg.getLength());
        }
    }
}
Also used : FragHeader(org.jgroups.protocols.FragHeader) Header(org.jgroups.Header) FragHeader(org.jgroups.protocols.FragHeader) NakAckHeader2(org.jgroups.protocols.pbcast.NakAckHeader2)

Aggregations

Header (org.jgroups.Header)1 FragHeader (org.jgroups.protocols.FragHeader)1 NakAckHeader2 (org.jgroups.protocols.pbcast.NakAckHeader2)1