PutRequest baseReq = new PutRequest();
if (txn != null) {
TransactionImpl.ensureTxnActive(txn);
baseReq.setTransaction(localTxnToRemoteTxn(txn));
}
final int baseEncodedReqSize = baseReq.encodingSize();
final List<Future<PutResponse>> futures = new ArrayList<Future<PutResponse>>();
int encodedReqSize = baseEncodedReqSize;
PutRequest req = baseReq.clone();
for (Entity entity : entities) {
EntityProto proto = EntityTranslator.convertToPb(entity);