byte[] compressed_payload=new byte[length];
int compressed_size;
int tmp_index=getDeflaterIndex();
Deflater deflater=deflater_pool[tmp_index]; // must be guaranteed to be non-null !
synchronized(deflater) {
deflater.reset();
deflater.setInput(payload, msg.getOffset(), length);
deflater.finish();
deflater.deflate(compressed_payload);
compressed_size=deflater.getTotalOut();
}