docs: @Override
      public void synchronousWrite(Object arg) {
          synchronized (syncSeqNum) {
  
              if (getEncrypt() && !encryptHeaderEmitted) {
                  String header = buildEncryptionHeader();
                  auditLog.writeRecord(header);
                  encryptHeaderEmitted = true;
              }
  
              if (getSign() && !signerHeaderEmitted) {
                  String header = buildSignerHeader();
                  auditLog.writeRecord(header);
                  signerHeaderEmitted = true;
              }
  
              try {
                  // AuditEvent event = (AuditEvent) arg;
                  AuditEvent event = new AuditEvent();
                  GenericData gdo = (GenericData) arg;
  
                  for (KeyValuePair kvp : gdo.getPairs()) {
                      if (kvp instanceof KeyValueStringPair) {
                          if (!kvp.getKey().equals(LogFieldConstants.IBM_DATETIME) &&
                              (!kvp.getKey().equals(LogFieldConstants.IBM_SEQUENCE))) {
                              event.set(kvp.getKey(), kvp.getStringValue());
                          }
                      }
                  }
  
                  //event.set(AuditConstants.EVENT_SEQUENCE_NUMBER, eventSequenceNumber++);
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                      Tr.debug(tc, "Received event " + event, this);
                  }
                  AuditService auditService = auditServiceRef.getService();
                  if (auditService != null) {
  
                      String en = (String) event.getMap().get(AuditEvent.EVENTNAME);
                      String eo = (String) event.getMap().get(AuditEvent.OUTCOME);
                      if (auditService.isAuditRequired(en, eo)) {
                          if (getEncrypt()) {
                              String jsonEvent = mapToJSONString(event.getMap());
  
                              byte[] er = null;
                              byte[] encryptedAuditRecord = null;
                              byte[] eventBytes = jsonEvent.getBytes("UTF-8");
                              String z = new String(eventBytes);
                              if (tc.isDebugEnabled())
                                  Tr.debug(tc, "eventBytes: " + z + "eventBytes.length: " + eventBytes.length);
                              er = ae.encrypt(eventBytes, sharedKey);
                              encryptedAuditRecord = new byte[er.length];
  
                              System.arraycopy(er, 0, encryptedAuditRecord, 0, er.length);
  
                              if (tc.isDebugEnabled()) {
                                  Tr.debug(tc, "length of er: " + er.length + " length of encryptedAuditRecord: " + encryptedAuditRecord.length);
                                  Tr.debug(tc, "encryptedAuditRecord: " + new String(encryptedAuditRecord));
                                  Tr.debug(tc, "er: " + new String(er));
                              }
  
                              if (getSign()) {
                                  signedEncryptedAuditRecord = as.sign(er, signedSharedKey);
  
                                  byte[] sopen = signatureOpenTag.getBytes();
                                  byte[] sclose = signatureCloseTag.getBytes();
  
                                  baos = new ByteArrayOutputStream(er.length + sopen.length + signedEncryptedAuditRecord.length + sclose.length);
                                  baos.write(er, 0, er.length);
                                  baos.write(sopen, 0, sopen.length);
                                  baos.write(signedEncryptedAuditRecord, 0, signedEncryptedAuditRecord.length);
                                  baos.write(sclose, 0, sclose.length);
                                  mergedByteRecord = new byte[baos.toByteArray().length];
                                  mergedByteRecord = baos.toByteArray();
  
                                  byte[] tmpPrivate = Base64Coder.base64Encode(mergedByteRecord);
  
                                  synchronized (syncObject) {
  
                                      long total_to_add_length = begin.getBytes().length + tmpPrivate.length + end.getBytes().length;
                                      if (tc.isDebugEnabled())
                                          Tr.debug(tc, "total_to_add_length: " + total_to_add_length);
                                      long currentFileSize = auditLog.getCurrentCountStream();
                                      if (tc.isDebugEnabled())
                                          Tr.debug(tc, "currentFileSize: " + currentFileSize);
                                      if (currentFileSize != 0) {
                                          if (getMaxFileSize() != 0) {
                                              long max = (long) ((getMaxFileSize())) * 1024L * 1024L;
                                              if (tc.isDebugEnabled())
                                                  Tr.debug(tc, "maxFileSize: " + max);
  
                                              if ((currentFileSize + total_to_add_length) >= max) {
                                                  if (tc.isDebugEnabled())
                                                      Tr.debug(tc, "adding padding to roll into new log");
                                                  byte[] padding = new byte[(int) (max - currentFileSize)];
                                                  auditLog.writeRecord(padding, buildEncSignerHeader());
                                                  // this should get us to roll over to a new log
                                              }
                                          }
                                          auditLog.writeRecord(begin);
                                          auditLog.writeRecord(tmpPrivate, buildEncSignerHeader());
                                          auditLog.writeRecord(end);
                                      }
  
                                  }
                                  if (tc.isDebugEnabled()) {
                                      Tr.debug(tc, "mergedByteRecord: " + new String(tmpPrivate));
                                  }
  
                              } else {
                                  byte[] tmpPrivate = Base64Coder.base64Encode(er);
  
                                  synchronized (syncObject) {
  
                                      long total_to_add_length = begin.getBytes().length + tmpPrivate.length + end.getBytes().length;
                                      if (tc.isDebugEnabled())
                                          Tr.debug(tc, "total_to_add_length: " + total_to_add_length);
                                      long currentFileSize = auditLog.getCurrentCountStream();
                                      if (tc.isDebugEnabled())
                                          Tr.debug(tc, "currentFileSize: " + currentFileSize);
                                      if (currentFileSize != 0) {
                                          if (getMaxFileSize() != 0) {
                                              long max = (long) ((getMaxFileSize())) * 1024L * 1024L;
                                              if (tc.isDebugEnabled())
                                                  Tr.debug(tc, "maxFileSize: " + max);
  
                                              if ((currentFileSize + total_to_add_length) >= max) {
                                                  if (tc.isDebugEnabled())
                                                      Tr.debug(tc, "adding padding to roll into new log");
                                                  byte[] padding = new byte[(int) (max - currentFileSize)];
                                                  auditLog.writeRecord(padding, buildEncSignerHeader());
                                                  // this should get us to roll over to a new log
                                              }
  
                                          }
  
                                          auditLog.writeRecord(begin);
                                          auditLog.writeRecord(tmpPrivate, buildEncSignerHeader());
                                          auditLog.writeRecord(end);
  
                                      }
  
                                  }
                              }
  
                          } // if encrypted, and maybe if signed
                          if (getSign() && !getEncrypt()) {
                              // only if signed
  
                              String jsonEvent = mapToJSONString(event.getMap());
  
                              byte[] eventBytes = jsonEvent.getBytes("UTF-8");
  
                              signedAuditRecord = as.sign(eventBytes, signedSharedKey);
  
                              byte[] sopen = signatureOpenTag.getBytes();
                              byte[] sclose = signatureCloseTag.getBytes();
  
                              baos = new ByteArrayOutputStream(eventBytes.length + sopen.length + signedAuditRecord.length + sclose.length);
                              baos.write(eventBytes, 0, eventBytes.length);
                              baos.write(sopen, 0, sopen.length);
                              baos.write(signedAuditRecord, 0, signedAuditRecord.length);
                              baos.write(sclose, 0, sclose.length);
  
                              mergedByteRecord = new byte[baos.toByteArray().length];
                              mergedByteRecord = baos.toByteArray();
  
                              byte[] tmpPrivate = Base64Coder.base64Encode(mergedByteRecord);
  
                              synchronized (syncObject) {
  
                                  long total_to_add_length = begin.getBytes().length + tmpPrivate.length + end.getBytes().length;
                                  if (tc.isDebugEnabled())
                                      Tr.debug(tc, "total_to_add_length: " + total_to_add_length);
                                  long currentFileSize = auditLog.getCurrentCountStream();
                                  if (tc.isDebugEnabled())
                                      Tr.debug(tc, "currentFileSize: " + currentFileSize);
                                  if (currentFileSize != 0) {
                                      if (getMaxFileSize() != 0) {
                                          long max = (long) ((getMaxFileSize())) * 1024L * 1024L;
                                          if (tc.isDebugEnabled())
                                              Tr.debug(tc, "maxFileSize: " + max);
  
                                          if ((currentFileSize + total_to_add_length) >= max) {
                                              if (tc.isDebugEnabled())
                                                  Tr.debug(tc, "adding padding to roll into new log");
                                              byte[] padding = new byte[(int) (max - currentFileSize)];
                                              auditLog.writeRecord(padding, buildEncSignerHeader());
                                              // this should get us to roll over to a new log
                                          }
                                      }
                                      auditLog.writeRecord(begin);
                                      auditLog.writeRecord(tmpPrivate, buildEncSignerHeader());
                                      auditLog.writeRecord(end);
                                  }
  
                              }
  
                              if (tc.isDebugEnabled()) {
                                  Tr.debug(tc, "mergedByteRecord: " + new String(tmpPrivate));
                              }
  
                          }
                          if (!getEncrypt() && !getSign()) {
                              auditLog.writeRecord(mapToJSONString(event.getMap()));
                          }
                      }
  
                  }
              } catch (Exception e) {
  
              }
          }
      }