public boolean isBlockingCommand() { return RedisCommands.BLOCKING_COMMAND_NAMES.contains(command.getName()) || RedisCommands.BLOCKING_COMMANDS.contains(command); }
public boolean isBlockingCommand() { return RedisCommands.BLOCKING_COMMAND_NAMES.contains(command.getName()) || RedisCommands.BLOCKING_COMMANDS.contains(command); }
@Override public List<CommandData<Object, Object>> getPubSubOperations() { if (RedisCommands.PUBSUB_COMMANDS.contains(getCommand().getName())) { return Collections.singletonList((CommandData<Object, Object>)this); } return Collections.emptyList(); }
@Override public List<CommandData<Object, Object>> getPubSubOperations() { List<CommandData<Object, Object>> result = new ArrayList<CommandData<Object, Object>>(); for (CommandData<?, ?> commandData : commands) { if (RedisCommands.PUBSUB_COMMANDS.equals(commandData.getCommand().getName())) { result.add((CommandData<Object, Object>)commandData); } } return result; }
@Override public List<CommandData<Object, Object>> getPubSubOperations() { if (RedisCommands.PUBSUB_COMMANDS.contains(getCommand().getName())) { return Collections.singletonList((CommandData<Object, Object>)this); } return Collections.emptyList(); }
@Override public List<CommandData<Object, Object>> getPubSubOperations() { List<CommandData<Object, Object>> result = new ArrayList<CommandData<Object, Object>>(); for (CommandData<?, ?> commandData : commands) { if (RedisCommands.PUBSUB_COMMANDS.equals(commandData.getCommand().getName())) { result.add((CommandData<Object, Object>)commandData); } } return result; }
@Override protected <V, R> void releaseConnection(NodeSource source, RFuture<RedisConnection> connectionFuture, boolean isReadOnly, RPromise<R> attemptPromise, AsyncDetails<V, R> details) { if (!isRedisBasedQueue() || RedisCommands.EXEC.getName().equals(details.getCommand().getName())) { super.releaseConnection(source, connectionFuture, isReadOnly, attemptPromise, details); } }
protected void indexCommand(RedisCommand<?> command) { if (isQueueing() || isPipelined()) { index++; if (commandsToRemove.contains(command.getName())) { indexToRemove.add(index); } } }
@Override protected <V, R> void releaseConnection(NodeSource source, RFuture<RedisConnection> connectionFuture, boolean isReadOnly, RPromise<R> attemptPromise, AsyncDetails<V, R> details) { if (!isRedisBasedQueue() || RedisCommands.EXEC.getName().equals(details.getCommand().getName())) { super.releaseConnection(source, connectionFuture, isReadOnly, attemptPromise, details); } }
public void addPubSubCommand(ChannelName channel, CommandData<Object, Object> data) { String operation = data.getCommand().getName().toLowerCase(); commands.put(new PubSubKey(channel, operation), data); }
protected void indexCommand(RedisCommand<?> command) { if (isQueueing() || isPipelined()) { index++; if (commandsToRemove.contains(command.getName())) { indexToRemove.add(index); } } }
protected void indexCommand(RedisCommand<?> command) { if (isQueueing() || isPipelined()) { index++; if (commandsToRemove.contains(command.getName())) { indexToRemove.add(index); } } }
protected void indexCommand(RedisCommand<?> command) { if (isQueueing() || isPipelined()) { index++; if (commandsToRemove.contains(command.getName())) { indexToRemove.add(index); } } }
public void addPubSubCommand(ChannelName channel, CommandData<Object, Object> data) { String operation = data.getCommand().getName().toLowerCase(); commands.put(new PubSubKey(channel, operation), data); }
protected boolean isWaitCommand(BatchCommandData<?, ?> c) { return c.getCommand().getName().equals(RedisCommands.WAIT.getName()); }
protected boolean isWaitCommand(BatchCommandData<?, ?> c) { return c.getCommand().getName().equals(RedisCommands.WAIT.getName()); }
@Override protected Decoder<Object> selectDecoder(CommandData<Object, Object> data, List<Object> parts) { if (parts != null) { if (data != null && parts.size() == 1 && "pong".equals(parts.get(0))) { return data.getCodec().getValueDecoder(); } if (parts.size() == 1) { return ByteArrayCodec.INSTANCE.getValueDecoder(); } if (parts.size() == 2 && "pmessage".equals(parts.get(0))) { return ByteArrayCodec.INSTANCE.getValueDecoder(); } if (parts.size() == 2 && "message".equals(parts.get(0))) { byte[] channelName = (byte[]) parts.get(1); return getDecoder(parts, channelName); } if (parts.size() == 3 && "pmessage".equals(parts.get(0))) { byte[] patternName = (byte[]) parts.get(1); return getDecoder(parts, patternName); } } if (data != null && data.getCommand().getName().equals(RedisCommands.PING.getName())) { return data.getCodec().getValueDecoder(); } return super.selectDecoder(data, parts); }
@Override protected Decoder<Object> selectDecoder(CommandData<Object, Object> data, List<Object> parts) { if (parts != null) { if (data != null && parts.size() == 1 && "pong".equals(parts.get(0))) { return data.getCodec().getValueDecoder(); } if (parts.size() == 1) { return ByteArrayCodec.INSTANCE.getValueDecoder(); } if (parts.size() == 2 && "pmessage".equals(parts.get(0))) { return ByteArrayCodec.INSTANCE.getValueDecoder(); } if (parts.size() == 2 && "message".equals(parts.get(0))) { byte[] channelName = (byte[]) parts.get(1); return getDecoder(parts, channelName); } if (parts.size() == 3 && "pmessage".equals(parts.get(0))) { byte[] patternName = (byte[]) parts.get(1); return getDecoder(parts, patternName); } } if (data != null && data.getCommand().getName().equals(RedisCommands.PING.getName())) { return data.getCodec().getValueDecoder(); } return super.selectDecoder(data, parts); }
@Override protected <V, R> void handleSuccess(final AsyncDetails<V, R> details, RPromise<R> promise, RedisCommand<?> command, R res) { if (RedisCommands.EXEC.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, res); return; } if (RedisCommands.DISCARD.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, null); if (executed.compareAndSet(false, true)) { details.getConnectionFuture().getNow().forceFastReconnectAsync().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } }); } return; } if (isRedisBasedQueue()) { BatchPromise<R> batchPromise = (BatchPromise<R>) promise; RPromise<R> sentPromise = (RPromise<R>) batchPromise.getSentPromise(); super.handleSuccess(details, sentPromise, command, null); semaphore.release(); } }
@Override protected <V, R> void handleSuccess(final AsyncDetails<V, R> details, RPromise<R> promise, RedisCommand<?> command, R res) { if (RedisCommands.EXEC.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, res); return; } if (RedisCommands.DISCARD.getName().equals(command.getName())) { super.handleSuccess(details, promise, command, null); if (executed.compareAndSet(false, true)) { details.getConnectionFuture().getNow().forceFastReconnectAsync().addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { CommandBatchService.super.releaseConnection(details.getSource(), details.getConnectionFuture(), details.isReadOnlyMode(), details.getAttemptPromise(), details); } }); } return; } if (isRedisBasedQueue()) { BatchPromise<R> batchPromise = (BatchPromise<R>) promise; RPromise<R> sentPromise = (RPromise<R>) batchPromise.getSentPromise(); super.handleSuccess(details, sentPromise, command, null); semaphore.release(); } }