redis.clients.jedis.executors.DefaultCommandExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jedis_preview Show documentation
Show all versions of jedis_preview Show documentation
Jedis is a blazingly small and sane Redis java client.
The newest version!
package redis.clients.jedis.executors;
import redis.clients.jedis.CommandObject;
import redis.clients.jedis.Connection;
import redis.clients.jedis.util.IOUtils;
import redis.clients.jedis.providers.ConnectionProvider;
public class DefaultCommandExecutor implements CommandExecutor {
protected final ConnectionProvider provider;
public DefaultCommandExecutor(ConnectionProvider provider) {
this.provider = provider;
}
@Override
public void close() {
IOUtils.closeQuietly(this.provider);
}
@Override
public final T executeCommand(CommandObject commandObject) {
try (Connection connection = provider.getConnection(commandObject.getArguments())) {
return connection.executeCommand(commandObject);
}
}
}