private Reply syncSend(Message msg, Duration timeout, DocumentOperationParameters parameters) {
        if (timeout != null) {
            parameters = parameters.withDeadline(Instant.now().plus(timeout));
        }
        try {
            RequestMonitor monitor = new RequestMonitor();
            msg.setContext(monitor);
            msg.pushHandler(this); // store monitor
            Result result = null;
            while (result == null || result.type() == Result.ResultType.TRANSIENT_ERROR) {
                result = session.send(msg, parameters);
                if (result != null && result.isSuccess()) {
                    break;
                }
                Thread.sleep(100);
            }
            if (!result.isSuccess()) {
                throw new DocumentAccessException(result.error().toString());
            }
            return monitor.waitForReply();
        } catch (InterruptedException e) {
            throw new DocumentAccessException(e);
        }
    }
Perform a synchronous sending of a message. This method block until the message is successfuly sent and a
corresponding reply has been received.

@param msg The message to send.
@return The reply received.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/MessageBusSyncSession.java