Skip to content

Commit

Permalink
Use long min value as a marker for unset sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
OptimumCode committed Oct 13, 2023
1 parent b1510ab commit 6802533
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ data class MessageId(
}


private const val SEQUENCE_NOT_SET = -1L
private const val SEQUENCE_NOT_SET = Long.MIN_VALUE

private class MessageIdBuilderImpl : MessageId.Builder {
private var _sessionAlias: String? = null
Expand Down Expand Up @@ -128,7 +128,7 @@ private class MessageIdBuilderImpl : MessageId.Builder {
override fun isDirectionSet(): Boolean = _direction != null

override fun setSequence(sequence: Long): MessageId.Builder = apply {
require(sequence > SEQUENCE_NOT_SET) { "Property \"sequence\" should not be negative" }
require(sequence != SEQUENCE_NOT_SET) { "Value $sequence for property \"sequence\" is reserved" }
this._sequence = sequence
}

Expand Down

0 comments on commit 6802533

Please sign in to comment.