Skip to content

Commit

Permalink
chore: add asserts, revert jetbrain#NotNull
Browse files Browse the repository at this point in the history
  • Loading branch information
okg-cxf committed Aug 8, 2024
1 parent 0d3df3b commit b4a90ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/java/io/lettuce/core/AutoBatchFlushOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.io.Serializable;

import io.lettuce.core.internal.LettuceAssert;

/**
* Options for command timeouts. These options configure how and whether commands time out once they were dispatched. Command
* timeout begins:
Expand Down Expand Up @@ -79,6 +81,8 @@ public Builder enableAutoBatchFlush(boolean enableAutoBatchFlush) {
* @return {@code this}
*/
public Builder writeSpinCount(int writeSpinCount) {
LettuceAssert.isPositive(writeSpinCount, "Batch size must be greater than 0");

this.writeSpinCount = writeSpinCount;
return this;
}
Expand All @@ -90,6 +94,8 @@ public Builder writeSpinCount(int writeSpinCount) {
* @return {@code this}
*/
public Builder batchSize(int batchSize) {
LettuceAssert.isPositive(batchSize, "Batch size must be greater than 0");

this.batchSize = batchSize;
return this;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/lettuce/core/ContextualChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.net.SocketAddress;

import javax.annotation.Nonnull;

import io.lettuce.core.context.ConnectionContext;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.Channel;
Expand All @@ -15,7 +17,6 @@
import io.netty.channel.EventLoop;
import io.netty.util.Attribute;
import io.netty.util.AttributeKey;
import org.jetbrains.annotations.NotNull;

/**
* @author chenxiaofan
Expand Down Expand Up @@ -250,7 +251,7 @@ public <T> boolean hasAttr(AttributeKey<T> attributeKey) {
}

@Override
public int compareTo(@NotNull Channel o) {
public int compareTo(@Nonnull Channel o) {
return this == o ? 0 : this.id().compareTo(o.id());
}

Expand Down

0 comments on commit b4a90ab

Please sign in to comment.