redis.clients.jedis.commands.ProtocolCommand Java Examples

The following examples show how to use redis.clients.jedis.commands.ProtocolCommand. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectionTest.java    From cachecloud with Apache License 2.0 6 votes vote down vote up
@Test
public void getErrorAfterConnectionReset() throws Exception {
  class TestConnection extends Connection {
    public TestConnection() {
      super("localhost", 6379);
    }

    @Override
    protected Connection sendCommand(ProtocolCommand cmd, byte[]... args) {
      return super.sendCommand(cmd, args);
    }
  }

  TestConnection conn = new TestConnection();

  try {
    conn.sendCommand(Command.HMSET, new byte[1024 * 1024 + 1][0]);
    fail("Should throw exception");
  } catch (JedisConnectionException jce) {
    assertEquals("ERR Protocol error: invalid multibulk length", jce.getMessage());
  }
}
 
Example #2
Source File: Connection.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
protected Connection sendCommand(final ProtocolCommand cmd, final String... args) {
  final byte[][] bargs = new byte[args.length][];
  for (int i = 0; i < args.length; i++) {
    bargs[i] = SafeEncoder.encode(args[i]);
  }
  return sendCommand(cmd, bargs);
}
 
Example #3
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Object sendCommand(ProtocolCommand cmd, byte[]... args) {
  Span span = helper.buildSpan("sendCommand");
  span.setTag("cmd", nullable(cmd));
  span.setTag("args", TracingHelper.toString(args));
  return helper.decorate(span, () -> wrapped.sendCommand(cmd, args));
}
 
Example #4
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 5 votes vote down vote up
@Override
public Object sendCommand(ProtocolCommand cmd,
    String... args) {
  Span span = helper.buildSpan("sendCommand");
  span.setTag("cmd", nullable(cmd));
  span.setTag("args", Arrays.toString(args));
  return helper.decorate(span, () -> wrapped.sendCommand(cmd, args));
}
 
Example #5
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getAggregateCommand() {
    return ClusterCommand.AGGREGATE;
}
 
Example #6
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getAliasDelCommand() {
    return ClusterCommand.ALIASDEL;
}
 
Example #7
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getCursorCommand() {
  return ClusterCommand.CURSOR;
}
 
Example #8
Source File: Client.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private BinaryClient sendCommand(Jedis conn, ProtocolCommand provider, String... args) {
    BinaryClient client = conn.getClient();
    client.sendCommand(provider, args);
    return client;
}
 
Example #9
Source File: Protocol.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
public static void sendCommand(final RedisOutputStream os, final ProtocolCommand command,
    final byte[]... args) {
  sendCommand(os, command.getRaw(), args);
}
 
Example #10
Source File: Connection.java    From cachecloud with Apache License 2.0 4 votes vote down vote up
protected Connection sendCommand(final ProtocolCommand cmd) {
  return sendCommand(cmd, EMPTY_ARGS);
}
 
Example #11
Source File: TracingJedisWrapper.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public Object sendCommand(ProtocolCommand cmd) {
  Span span = helper.buildSpan("sendCommand");
  span.setTag("cmd", nullable(cmd));
  return helper.decorate(span, () -> wrapped.sendCommand(cmd));
}
 
Example #12
Source File: Client.java    From JRedisBloom with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private Connection sendCommand(Jedis conn, ProtocolCommand command, byte[]... args) {
  Connection client = conn.getClient();
  client.sendCommand(command, args);
  return client;
}
 
Example #13
Source File: Client.java    From JRedisBloom with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private Connection sendCommand(Jedis conn, String key, ProtocolCommand command, String ...args) {
  byte[][] fullArgs = new byte[args.length + 1][];
  fullArgs[0] = SafeEncoder.encode(key);
  System.arraycopy( SafeEncoder.encodeMany(args), 0, fullArgs, 1, args.length);
  return sendCommand(conn, command, fullArgs);
}
 
Example #14
Source File: ClusterClient.java    From JRedisBloom with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void sendCommand(Connection conn, String key, ProtocolCommand command, String ...args) {
    String[] fullArgs = new String[args.length + 1];
    fullArgs[0] = key;
    System.arraycopy(args, 0, fullArgs, 1, args.length);
    conn.sendCommand(command, fullArgs);
}
 
Example #15
Source File: Client.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private BinaryClient sendCommand(Jedis conn, ProtocolCommand provider, byte[]... args) {
    BinaryClient client = conn.getClient();
    client.sendCommand(provider, args);
    return client;
}
 
Example #16
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getAliasUpdateCommand() {
    return ClusterCommand.ALIASUPDATE;
}
 
Example #17
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getSynAddCommand() {
  return Command.SYNADD;
}
 
Example #18
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getGetCommand() {
    return ClusterCommand.GET;
}
 
Example #19
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getExplainCommand() {
    return ClusterCommand.EXPLAIN;
}
 
Example #20
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getSearchCommand() {
    return ClusterCommand.SEARCH;
}
 
Example #21
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getDropCommand() {
    return ClusterCommand.DROP;
}
 
Example #22
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getInfoCommand() {
    return ClusterCommand.INFO;
}
 
Example #23
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getDelCommand() {
    return ClusterCommand.DEL;
}
 
Example #24
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getAddHashCommand() {
    return ClusterCommand.ADDHASH;
}
 
Example #25
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getAddCommand() {
    return ClusterCommand.ADD;
}
 
Example #26
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getAlterCommand() {
    return ClusterCommand.ALTER;
}
 
Example #27
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getCreateCommand() {
    return ClusterCommand.CREATE;
}
 
Example #28
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getSynDumpCommand() {
  return Command.SYNDUMP;
}
 
Example #29
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getSynUpdateCommand() {
  return Command.SYNUPDATE;
}
 
Example #30
Source File: Commands.java    From JRediSearch with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ProtocolCommand getMGetCommand() {
  return Command.MGET;
}