Skip to content

Commit

Permalink
Address PR feedback.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Dec 19, 2023
1 parent 3c786c6 commit 647d802
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ public CompletableFuture<Response> registerConnection() {
* @param response A response received
*/
public void completeRequest(Response response) {
// A connection response doesn't contain a callback id
int callbackId =
clientState.isInitializing() ? response.getCallbackIdx() : CONNECTION_PROMISE_ID;
var future = responses.get(callbackId);
CompletableFuture<Response> future = responses.get(callbackId);
if (future != null) {
future.completeAsync(() -> response);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public class ThreadPoolAllocator {
public static EventLoopGroup createNettyThreadPool(String prefix, Optional<Integer> threadLimit) {
int threadCount = threadLimit.orElse(Runtime.getRuntime().availableProcessors());
if (Platform.getCapabilities().isKQueueAvailable()) {
var name = prefix + "-kqueue-elg";
String name = prefix + "-kqueue-elg";
return getOrCreate(
name + threadCount,
() -> new KQueueEventLoopGroup(threadCount, new DefaultThreadFactory(name, true)));
} else if (Platform.getCapabilities().isEPollAvailable()) {
var name = prefix + "-epoll-elg";
String name = prefix + "-epoll-elg";
return getOrCreate(
name + threadCount,
() -> new EpollEventLoopGroup(threadCount, new DefaultThreadFactory(name, true)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class RedisValueResolver {
* Resolve a value received from Redis using given C-style pointer.
*
* @param pointer A memory pointer from {@link Response}
* @return A RESP2 value
* @return A RESP3 value
*/
public static native Object valueFromPointer(long pointer);
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ private String extractValueFromResponse(Response response) {
} else if (response.hasRespPointer()) {
return RedisValueResolver.valueFromPointer(response.getRespPointer()).toString();
}
return null;
throw new IllegalStateException("A malformed response received: " + response.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private boolean checkBabushkaResponse(Response response) {
"Unexpected response data: "
+ RedisValueResolver.valueFromPointer(response.getRespPointer()));
}
return false;
throw new IllegalStateException("A malformed response received: " + response.toString());
}

/**
Expand Down

0 comments on commit 647d802

Please sign in to comment.