try {
deflater=deflater_pool.take();
deflater.reset();
deflater.setInput(payload, msg.getOffset(), length);
deflater.finish();
deflater.deflate(compressed_payload);
compressed_size=deflater.getTotalOut();
byte[] new_payload=new byte[compressed_size];
System.arraycopy(compressed_payload, 0, new_payload, 0, compressed_size);
msg.setBuffer(new_payload);
msg.putHeader(name, new CompressHeader(length));