@Override public synchronized void writeRecord(LogRecord record, Promise<DLSN> transmitPromise) throws LogRecordTooLongException, WriteException { int logRecordSize = record.getPersistentSize(); if (logRecordSize > MAX_LOGRECORD_SIZE) { throw new LogRecordTooLongException( "Log Record of size " + logRecordSize + " written when only " + MAX_LOGRECORD_SIZE + " is allowed"); } try { this.writer.writeOp(record); int numRecords = 1; if (!record.isControl()) { hasUserData = true; } if (record.isRecordSet()) { numRecords = LogRecordSet.numRecords(record); } count += numRecords; writeRequests.add(new WriteRequest(numRecords, transmitPromise)); maxTxId = Math.max(maxTxId, record.getTransactionId()); } catch (IOException e) { logger.error("Failed to append record to record set of {} : ", logName, e); throw new WriteException(logName, "Failed to append record to record set of " + logName); } }
synchronized public Future<DLSN> writeInternal(LogRecord record) throws LogRecordTooLongException, LockingException, BKTransmitException, WriteException, InvalidEnvelopedEntryException { int logRecordSize = record.getPersistentSize();