templates.java.nettyclient.txt Maven / Gradle / Ivy
package redis.netty.client;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
import com.google.common.base.Charsets;
import redis.Command;
import redis.netty.BulkReply;
import redis.netty.IntegerReply;
import redis.netty.MultiBulkReply;
import redis.netty.Reply;
import redis.netty.StatusReply;
import spullara.util.concurrent.Promise;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@SuppressWarnings("UnusedDeclaration")
public class RedisClient extends RedisClientBase {
private static ExecutorService defaultExecutor;
public static synchronized Promise connect(String host, int port) {
if (defaultExecutor == null) {
defaultExecutor = Executors.newCachedThreadPool();
}
RedisClient redisClient = new RedisClient();
return RedisClientBase.connect(host, port, redisClient, defaultExecutor);
}
{{#commands}}
private static final String {{name}} = "{{name1}}";
{{#split_command}}
private static final String {{name}}2 = "{{name2}}";
private static final byte[] {{name}}2_BYTES = {{name}}2.getBytes(Charsets.US_ASCII);
{{/split_command}}
private static final byte[] {{name}}_BYTES = {{name}}.getBytes(Charsets.US_ASCII);
private static final int {{name}}_VERSION = parseVersion("{{version}}");
/**
* {{comment}}
* {{group}}
*
{{#arguments}}
* @param {{name}}
{{/arguments}}
* @return {{reply}}
*/
public Promise<{{$return}}{{reply}}{{/return}}> {{methodname}}({{#arguments}}{{^first}}, {{/first}}{{typename}}{{#multiple}}[]{{/multiple}} {{name}}{{/arguments}}) {
if (version < {{name}}_VERSION) return new Promise<>(new RedisException("Server does not support {{name}}"));
{{#usearray}}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy