Skip to content

Commit

Permalink
More clean up after merge
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Carbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Jan 3, 2024
1 parent 75d2494 commit 617ab3e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 70 deletions.
17 changes: 16 additions & 1 deletion java/client/src/main/java/glide/api/RedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@
*/
public class RedisClient extends BaseClient {

/**
* Request an async (non-blocking) Redis client in Standalone mode to a Redis service on localhost.
*
* @return a promise to connect and return a RedisClient
*/
public static CompletableFuture<RedisClient> CreateClient() {
return CreateClient(RedisClientConfiguration.builder().build());
}

/**
* Request an async (non-blocking) Redis client in Standalone mode.
*
* @param host - host address of the Redis service
* @param port - port of the Redis service
* @return a promise to connect and return a RedisClient
*/
public static CompletableFuture<RedisClient> CreateClient(String host, Integer port) {
RedisClientConfiguration config =
RedisClientConfiguration.builder()
Expand All @@ -47,6 +59,7 @@ protected static CompletableFuture<RedisClient> CreateClient(
RedisClientConfiguration config,
ConnectionManager connectionManager,
CommandManager commandManager) {
// TODO: Support exception throwing, including interrupted exceptions
return connectionManager
.connectToRedis(config)
.thenApplyAsync(ignore -> new RedisClient(connectionManager, commandManager));
Expand All @@ -58,7 +71,9 @@ protected RedisClient(ConnectionManager connectionManager, CommandManager comman

/**
* Closes this resource, relinquishing any underlying resources. This method is invoked
* automatically on objects managed by the try-with-resources statement. see: <a
* automatically on objects managed by the try-with-resources statement.
*
* <p>see: <a
* href="https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html#close--">AutoCloseable::close()</a>
*/
@Override
Expand Down
63 changes: 0 additions & 63 deletions java/client/src/main/java/glide/managers/CallbackManager.java

This file was deleted.

14 changes: 8 additions & 6 deletions java/client/src/main/java/glide/managers/ConnectionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,17 @@ private Void checkGlideRsResponse(Response response) {
String.format(
"%s: %s",
response.getRequestError().getType(), response.getRequestError().getMessage()));
} else if (response.hasClosingError()) {
}
if (response.hasClosingError()) {
throw new RuntimeException("Connection closed: " + response.getClosingError());
} else if (response.hasConstantResponse()) {
return null;
} else if (response.hasRespPointer()) {
}
if (response.hasRespPointer()) {
throw new RuntimeException("Unexpected data in response");
}
// throw new IllegalStateException("A malformed response received: " + response.toString());
return null;
if (response.hasConstantResponse()) {
return null;
}
throw new RuntimeException("Connection response expects an OK response");
}

/** Close the connection and the corresponding channel. */
Expand Down

0 comments on commit 617ab3e

Please sign in to comment.