Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ public List<PopConsumerRecord> scanExpiredRecords(long lower, long upper, int ma
// configure prefix indexing to improve the performance of scans.
// However, in the current implementation, this is not the bottleneck.
List<PopConsumerRecord> consumerRecordList = new ArrayList<>();
try (ReadOptions scanOptions = new ReadOptions()
.setIterateLowerBound(new Slice(ByteBuffer.allocate(Long.BYTES).putLong(lower).array()))
.setIterateUpperBound(new Slice(ByteBuffer.allocate(Long.BYTES).putLong(upper).array()));
try (Slice lowerBound = new Slice(ByteBuffer.allocate(Long.BYTES).putLong(lower).array());
Slice upperBound = new Slice(ByteBuffer.allocate(Long.BYTES).putLong(upper).array());
ReadOptions scanOptions = new ReadOptions()
.setIterateLowerBound(lowerBound)
.setIterateUpperBound(upperBound);
RocksIterator iterator = db.newIterator(this.columnFamilyHandle, scanOptions)) {
iterator.seek(ByteBuffer.allocate(Long.BYTES).putLong(lower).array());
while (iterator.isValid() && consumerRecordList.size() < maxCount) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ public void run() {
while (!this.isStopped()) {
try {
NettyEvent event = this.eventQueue.poll(3000, TimeUnit.MILLISECONDS);
if (event != null && listener != null) {
if (event != null && event.getType() != null && listener != null) {
switch (event.getType()) {
case IDLE:
listener.onChannelIdle(event.getRemoteAddr(), event.getChannel());
Expand Down Expand Up @@ -814,6 +814,14 @@ public void run() {
log.info(this.getServiceName() + " service end");
}

@Override
public void shutdown(final boolean interrupt) {
// wake up the thread blocked on eventQueue.poll() so it observes the stopped flag
// immediately instead of waiting for the next poll timeout
this.eventQueue.offer(new NettyEvent(null, null, null));
super.shutdown(interrupt);
}

@Override
public String getServiceName() {
return NettyEventExecutor.class.getSimpleName();
Expand Down