code: @Override
      public void write(PendingEvent event) {
          //State is set to sealed during a Transaction abort and the segment writer should not throw an {@link IllegalStateException} in such a case.
          checkState(StreamSegmentNameUtils.isTransactionSegment(segmentName) || !state.isAlreadySealed(), "Segment: %s is already sealed", segmentName);
          synchronized (writeOrderLock) {
              ClientConnection connection;
              try {
                  // if connection is null getConnection() establishes a connection and retransmits all events in inflight
                  // list.
                  connection = Futures.getThrowingException(getConnection());
              } catch (SegmentSealedException | NoSuchSegmentException e) {
                  // Add the event to inflight, this will be resent to the succesor during the execution of resendToSuccessorsCallback
                  state.addToInflight(event);
                  return;
              }
              long eventNumber = state.addToInflight(event);
              try {
                  Append append = new Append(segmentName, writerId, eventNumber, 1, event.getData(), null, requestId);
                  log.trace("Sending append request: {}", append);
                  connection.send(append);
              } catch (ConnectionFailedException e) {
                  log.warn("Connection " + writerId + " failed due to: ", e);
                  reconnect(); // As the message is inflight, this will perform the retransmission.
              }
          }
      }
docs: @see SegmentOutputStream#write(PendingEvent)