private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
private boolean isPipelined() { return connection.isPipelined(); }
<T> T execute(String command, byte[][] args, Function<Client, T> resultMapper, Function<Object, Response<?>> pipelineResponseMapper) { Assert.hasText(command, "A valid command needs to be specified!"); Assert.notNull(args, "Arguments must not be null!"); try { Client client = JedisClientUtils.sendCommand(command, args, this.jedis); if (isQueueing() || isPipelined()) { Response<?> result = pipelineResponseMapper .apply(isPipelined() ? getRequiredPipeline() : getRequiredTransaction()); if (isPipelined()) { pipeline(newJedisResult(result)); } else { transaction(newJedisResult(result)); } return null; } return resultMapper.apply(client); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public void pSubscribe(MessageListener listener, byte[]... patterns) { if (isSubscribed()) { throw new RedisSubscribedConnectionException( "Connection already subscribed; use the connection Subscription to cancel or add new channels"); } if (isQueueing()) { throw new UnsupportedOperationException(); } if (isPipelined()) { throw new UnsupportedOperationException(); } try { BinaryJedisPubSub jedisPubSub = new JedisMessageListener(listener); subscription = new JedisSubscription(listener, jedisPubSub, null, patterns); jedis.psubscribe(jedisPubSub, patterns); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public void multi() { if (isQueueing()) { return; } try { if (isPipelined()) { getRequiredPipeline().multi(); return; } this.transaction = jedis.multi(); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public void discard() { try { if (isPipelined()) { pipeline(newStatusResult(getRequiredPipeline().discard())); return; } getRequiredTransaction().discard(); } catch (Exception ex) { throw convertJedisAccessException(ex); } finally { txResults.clear(); transaction = null; } }
@Override public List<Object> exec() { try { if (isPipelined()) { pipeline(newJedisResult(getRequiredPipeline().exec(), new TransactionResultConverter<>(new LinkedList<>(txResults), JedisConverters.exceptionConverter()))); return null; } if (transaction == null) { throw new InvalidDataAccessApiUsageException("No ongoing transaction. Did you forget to call multi?"); } List<Object> results = transaction.exec(); return !CollectionUtils.isEmpty(results) ? new TransactionResultConverter<>(txResults, JedisConverters.exceptionConverter()).convert(results) : results; } catch (Exception ex) { throw convertJedisAccessException(ex); } finally { txResults.clear(); transaction = null; } }
@Override public void watch(byte[]... keys) { if (isQueueing()) { throw new UnsupportedOperationException(); } try { for (byte[] key : keys) { if (isPipelined()) { pipeline(newStatusResult(getRequiredPipeline().watch(key))); } else { jedis.watch(key); } } } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Long publish(byte[] channel, byte[] message) { try { if (isPipelined()) { pipeline(newJedisResult(getRequiredPipeline().publish(channel, message))); return null; } if (isQueueing()) { transaction(newJedisResult(getRequiredTransaction().publish(channel, message))); return null; } return jedis.publish(channel, message); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public byte[] echo(byte[] message) { try { if (isPipelined()) { pipeline(newJedisResult(getRequiredPipeline().echo(message))); return null; } if (isQueueing()) { transaction(newJedisResult(getRequiredTransaction().echo(message))); return null; } return jedis.echo(message); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public String ping() { try { if (isPipelined()) { pipeline(newJedisResult(getRequiredPipeline().ping())); return null; } if (isQueueing()) { transaction(newJedisResult(getRequiredTransaction().ping())); return null; } return jedis.ping(); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public void select(int dbIndex) { try { if (isPipelined()) { pipeline(newStatusResult(getRequiredPipeline().select(dbIndex))); return; } if (isQueueing()) { transaction(newStatusResult(getRequiredTransaction().select(dbIndex))); return; } jedis.select(dbIndex); } catch (Exception ex) { throw convertJedisAccessException(ex); } }