proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/MultiNodeExecution.java | MultiNodeExecution | firstOfAsync | class MultiNodeExecution {
public static <T> T execute(Callable<T> function) {
try {
return function.call();
} catch (Exception e) {
throw Exceptions.bubble(e);
}
}
/**
* Aggregate (sum) results of the {@link RedisFuture}s.
*
* @param executio... |
return new PipelinedRedisFuture<>(executions, objectPipelinedRedisFuture -> {
// make sure, that all futures are executed before returning the result.
for (CompletionStage<T> future : executions.values()) {
execute(() -> future.toCompletableFuture().get());
... | 855 | 131 | 986 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/PartitionAccessor.java | PartitionAccessor | get | class PartitionAccessor {
private final Collection<RedisClusterNode> partitions;
PartitionAccessor(Collection<RedisClusterNode> partitions) {
this.partitions = partitions;
}
List<RedisClusterNode> getUpstream() {
return get(redisClusterNode -> redisClusterNode.is(RedisClusterNode.Node... |
List<RedisClusterNode> result = new ArrayList<>(partitions.size());
for (RedisClusterNode partition : partitions) {
if (test.test(partition)) {
result.add(partition);
}
}
return result;
| 241 | 67 | 308 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/PartitionsConsensusImpl.java | KnownMajority | getPartitions | class KnownMajority extends PartitionsConsensus {
@Override
Partitions getPartitions(Partitions current, Map<RedisURI, Partitions> topologyViews) {<FILL_FUNCTION_BODY>}
} |
if (topologyViews.isEmpty()) {
return current;
}
List<VotedPartitions> votedList = new ArrayList<>();
for (Partitions partitions : topologyViews.values()) {
int knownNodes = 0;
for (RedisClusterNode knownNode : current)... | 60 | 203 | 263 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java | NotifyingMessageListener | ssubscribed | class NotifyingMessageListener extends RedisClusterPubSubAdapter<K, V> {
@Override
public void message(RedisClusterNode node, K channel, V message) {
getListeners().forEach(listener -> listener.message(channel, message));
clusterListeners.forEach(listener -> listener.message(no... |
getListeners().forEach(listener -> listener.ssubscribed(channel, count));
clusterListeners.forEach(listener -> listener.ssubscribed(node, channel, count));
| 523 | 51 | 574 | <methods>public void <init>(io.lettuce.core.ClientOptions, io.lettuce.core.resource.ClientResources) ,public void addListener(RedisPubSubListener<K,V>) ,public Set<K> getChannels() ,public Set<K> getPatterns() ,public boolean hasChannelSubscriptions() ,public boolean hasPatternSubscriptions() ,public boolean isSubscrib... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/RedisClusterPubSubAsyncCommandsImpl.java | RedisClusterPubSubAsyncCommandsImpl | nodes | class RedisClusterPubSubAsyncCommandsImpl<K, V> extends RedisPubSubAsyncCommandsImpl<K, V>
implements RedisClusterPubSubAsyncCommands<K, V> {
/**
* Initialize a new connection.
*
* @param connection the connection .
* @param codec Codec used to encode/decode keys and values.
*/
... |
PubSubAsyncNodeSelection<K, V> selection = new StaticPubSubAsyncNodeSelection<>(getStatefulConnection(), predicate);
NodeSelectionInvocationHandler h = new NodeSelectionInvocationHandler((AbstractNodeSelection<?, ?, ?, ?>) selection,
RedisPubSubAsyncCommands.class, ASYNC);
ret... | 1,005 | 143 | 1,148 | <methods>public void <init>(StatefulRedisPubSubConnection<K,V>, RedisCodec<K,V>) ,public StatefulRedisPubSubConnection<K,V> getStatefulConnection() ,public transient RedisFuture<java.lang.Void> psubscribe(K[]) ,public RedisFuture<java.lang.Long> publish(K, V) ,public RedisFuture<List<K>> pubsubChannels(K) ,public trans... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/RedisClusterPubSubReactiveCommandsImpl.java | StaticPubSubReactiveNodeSelection | getConnection | class StaticPubSubReactiveNodeSelection<K, V>
extends AbstractNodeSelection<RedisPubSubReactiveCommands<K, V>, NodeSelectionPubSubReactiveCommands<K, V>, K, V>
implements PubSubReactiveNodeSelection<K, V> {
private final List<RedisClusterNode> redisClusterNodes;
private final C... |
RedisURI uri = redisClusterNode.getUri();
AsyncClusterConnectionProvider async = (AsyncClusterConnectionProvider) writer.getClusterConnectionProvider();
return async.getConnectionAsync(ConnectionIntent.WRITE, uri.getHost(), uri.getPort())
.thenApply(it -> (Stat... | 364 | 92 | 456 | <methods>public void <init>(StatefulRedisPubSubConnection<K,V>, RedisCodec<K,V>) ,public StatefulRedisPubSubConnection<K,V> getStatefulConnection() ,public Flux<ChannelMessage<K,V>> observeChannels() ,public Flux<ChannelMessage<K,V>> observeChannels(FluxSink.OverflowStrategy) ,public Flux<PatternMessage<K,V>> observePa... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/RedisClusterURIUtil.java | RedisClusterURIUtil | toRedisURIs | class RedisClusterURIUtil {
private RedisClusterURIUtil() {
}
/**
* Parse a Redis Cluster URI with potentially multiple hosts into a {@link List} of {@link RedisURI}.
*
* An URI follows the syntax: {@code redis://[password@]host[:port][,host2[:port2]]}
*
* @param uri must not be e... |
RedisURI redisURI = RedisURI.create(uri);
String[] parts = redisURI.getHost().split("\\,");
List<RedisURI> redisURIs = new ArrayList<>(parts.length);
for (String part : parts) {
HostAndPort hostAndPort = HostAndPort.parse(part);
RedisURI nodeUri = RedisURI.c... | 269 | 178 | 447 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/RoundRobin.java | RoundRobin | isConsistent | class RoundRobin<V> {
protected volatile Collection<? extends V> collection = Collections.emptyList();
protected volatile V offset;
private final BiPredicate<V, V> isEqual;
public RoundRobin() {
this((a, b) -> true);
}
public RoundRobin(BiPredicate<V, V> hasElementChanged) {
... |
Collection<? extends V> collection = this.collection;
if (collection.size() != leader.size()) {
return false;
}
for (V currentElement : collection) {
boolean found = find(leader, currentElement);
if (!found) {
return false;
... | 548 | 93 | 641 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/RoundRobinSocketAddressSupplier.java | RoundRobinSocketAddressSupplier | get | class RoundRobinSocketAddressSupplier implements Supplier<SocketAddress> {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(RoundRobinSocketAddressSupplier.class);
private final Supplier<Partitions> partitions;
private final Function<Collection<RedisClusterNode>, Collection<... |
Partitions partitions = this.partitions.get();
if (!roundRobin.isConsistent(partitions)) {
resetRoundRobin(partitions);
}
RedisClusterNode redisClusterNode = roundRobin.next();
return getSocketAddress(redisClusterNode);
| 483 | 77 | 560 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/SlotHash.java | SlotHash | getSlots | class SlotHash {
/**
* Constant for a subkey start.
*/
public static final byte SUBKEY_START = (byte) '{';
/**
* Constant for a subkey end.
*/
public static final byte SUBKEY_END = (byte) '}';
/**
* Number of redis cluster slot hashes.
*/
public static final int ... |
Map<K, S> result = new HashMap<>();
for (Map.Entry<S, ? extends Iterable<K>> entry : partitioned.entrySet()) {
for (K key : entry.getValue()) {
result.put(key, entry.getKey());
}
}
return result;
| 1,004 | 83 | 1,087 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/StatefulRedisClusterPubSubConnectionImpl.java | StatefulRedisClusterPubSubConnectionImpl | getConnectionAsync | class StatefulRedisClusterPubSubConnectionImpl<K, V> extends StatefulRedisPubSubConnectionImpl<K, V>
implements StatefulRedisClusterPubSubConnection<K, V> {
private final PubSubClusterEndpoint<K, V> endpoint;
private final ClusterPushHandler clusterPushHandler;
private volatile Partitions partiti... |
RedisURI redisURI = lookup(nodeId);
if (redisURI == null) {
throw new RedisException("NodeId " + nodeId + " does not belong to the cluster");
}
AsyncClusterConnectionProvider provider = (AsyncClusterConnectionProvider) getClusterDistributionChannelWriter()
... | 1,859 | 111 | 1,970 | <methods>public void <init>(PubSubEndpoint<K,V>, io.lettuce.core.RedisChannelWriter, RedisCodec<K,V>, java.time.Duration) ,public void activated() ,public void addListener(RedisPubSubListener<K,V>) ,public RedisPubSubAsyncCommands<K,V> async() ,public RedisPubSubReactiveCommands<K,V> reactive() ,public void removeListe... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/StaticNodeSelection.java | StaticNodeSelection | getConnection | class StaticNodeSelection<API, CMD, K, V> extends AbstractNodeSelection<API, CMD, K, V> {
private final ClusterDistributionChannelWriter writer;
private final ConnectionIntent connectionIntent;
private final List<RedisClusterNode> redisClusterNodes;
private final Function<StatefulRedisConnection<K, ... |
RedisURI uri = redisClusterNode.getUri();
AsyncClusterConnectionProvider async = (AsyncClusterConnectionProvider) writer.getClusterConnectionProvider();
return async.getConnectionAsync(connectionIntent, uri.getHost(), uri.getPort());
| 339 | 64 | 403 | <methods>public Map<io.lettuce.core.cluster.models.partitions.RedisClusterNode,API> asMap() ,public CMD commands() ,public API commands(int) ,public io.lettuce.core.cluster.models.partitions.RedisClusterNode node(int) ,public int size() <variables> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/event/ClusterTopologyChangedEvent.java | ClusterTopologyChangedEvent | toString | class ClusterTopologyChangedEvent implements Event {
private final List<RedisClusterNode> before;
private final List<RedisClusterNode> after;
/**
* Creates a new {@link ClusterTopologyChangedEvent}.
*
* @param before the cluster topology view before the topology changed, must not be {@code... |
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [before=").append(before.size());
sb.append(", after=").append(after.size());
sb.append(']');
return sb.toString();
| 317 | 73 | 390 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/models/slots/ClusterSlotRange.java | ClusterSlotRange | toRedisClusterNodes | class ClusterSlotRange implements Serializable {
private int from;
private int to;
private RedisClusterNode upstream;
private List<RedisClusterNode> replicaNodes = Collections.emptyList();
public ClusterSlotRange() {
}
/**
* Constructs a {@link ClusterSlotRange}
*
* @par... |
List<RedisClusterNode> result = new ArrayList<>();
for (HostAndPort hostAndPort : hostAndPorts) {
result.add(toRedisClusterNode(hostAndPort, slaveOf, flags));
}
return result;
| 863 | 64 | 927 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/models/slots/ClusterSlotsParser.java | ClusterSlotsParser | createSlots | class ClusterSlotsParser {
/**
* Utility constructor.
*/
private ClusterSlotsParser() {
}
/**
* Parse the output of the Redis CLUSTER SLOTS command and convert it to a list of
* {@link io.lettuce.core.cluster.models.slots.ClusterSlotRange}
*
* @param clusterSlotsOutput o... |
List<Integer> slots = new ArrayList<>();
for (int i = from; i < to + 1; i++) {
slots.add(i);
}
return slots;
| 1,342 | 50 | 1,392 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/topology/Connections.java | Connections | addConnection | class Connections {
private final static InternalLogger LOG = InternalLoggerFactory.getInstance(Connections.class);
private final Lock lock = new ReentrantLock();
private final ClientResources clientResources;
private final Map<RedisURI, StatefulRedisConnection<String, String>> connections;
pri... |
if (this.closed) { // fastpath
connection.closeAsync();
return;
}
try {
lock.lock();
if (this.closed) {
connection.closeAsync();
return;
}
this.connections.put(redisURI, connection);
... | 965 | 94 | 1,059 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java | ConnectionTracker | collectConnections | class ConnectionTracker {
private final Map<RedisURI, CompletableFuture<StatefulRedisConnection<String, String>>> connections = new LinkedHashMap<>();
public void addConnection(RedisURI uri, CompletableFuture<StatefulRedisConnection<String, String>> future) {
CompletableFuture<StatefulRedi... |
Map<RedisURI, StatefulRedisConnection<String, String>> activeConnections = new LinkedHashMap<>();
for (Map.Entry<RedisURI, CompletableFuture<StatefulRedisConnection<String, String>>> entry : connections
.entrySet()) {
CompletableFuture<StatefulRedisConnect... | 512 | 142 | 654 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java | NodeTopologyView | getOwnPartition | class NodeTopologyView {
private final boolean available;
private final RedisURI redisURI;
private Partitions partitions;
private final int connectedClients;
private final long replicationOffset;
private final long latency;
private final String clusterNodes;
private final String ... |
RedisClusterNode own = findOwnPartition();
if (own != null) {
return own;
}
throw new IllegalStateException("Cannot determine own partition");
| 1,357 | 48 | 1,405 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyViews.java | NodeTopologyViews | getClusterNodes | class NodeTopologyViews {
private List<NodeTopologyView> views;
public NodeTopologyViews(List<NodeTopologyView> views) {
this.views = views;
}
/**
* Return cluster node URI's using the topology query sources and partitions.
*
* @return
*/
public Set<RedisURI> getCluste... |
Set<RedisURI> result = new HashSet<>();
Map<String, RedisURI> knownUris = new HashMap<>();
for (NodeTopologyView view : views) {
knownUris.put(view.getNodeId(), view.getRedisURI());
}
for (NodeTopologyView view : views) {
for (RedisClusterNode redisClu... | 262 | 186 | 448 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/topology/Requests.java | Requests | mergeWith | class Requests {
private final Map<RedisURI, TimedAsyncCommand<String, String, String>> rawViews;
protected Requests() {
rawViews = new TreeMap<>(TopologyComparators.RedisURIComparator.INSTANCE);
}
private Requests(Map<RedisURI, TimedAsyncCommand<String, String, String>> rawViews) {
t... |
Map<RedisURI, TimedAsyncCommand<String, String, String>> result = new TreeMap<>(
TopologyComparators.RedisURIComparator.INSTANCE);
result.putAll(this.rawViews);
result.putAll(requests.rawViews);
return new Requests(result);
| 375 | 85 | 460 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/topology/TimedAsyncCommand.java | TimedAsyncCommand | duration | class TimedAsyncCommand<K, V, T> extends AsyncCommand<K, V, T> {
long encodedAtNs = -1;
long completedAtNs = -1;
public TimedAsyncCommand(RedisCommand<K, V, T> command) {
super(command);
}
@Override
public void encode(ByteBuf buf) {
completedAtNs = -1;
encodedAtNs = -... |
if (completedAtNs == -1 || encodedAtNs == -1) {
return -1;
}
return completedAtNs - encodedAtNs;
| 198 | 47 | 245 | <methods>public void <init>(RedisCommand<K,V,T>) ,public boolean await(long, java.util.concurrent.TimeUnit) ,public boolean cancel(boolean) ,public void cancel() ,public void complete() ,public boolean completeExceptionally(java.lang.Throwable) ,public void encode(ByteBuf) ,public boolean equals(java.lang.Object) ,publ... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/cluster/topology/TopologyComparators.java | PredefinedRedisClusterNodeComparator | compare | class PredefinedRedisClusterNodeComparator implements Comparator<RedisClusterNode> {
private final List<RedisURI> fixedOrder;
public PredefinedRedisClusterNodeComparator(List<RedisURI> fixedOrder) {
this.fixedOrder = fixedOrder;
}
@Override
public int compare(Redis... |
if (o1 instanceof RedisClusterNodeSnapshot && o2 instanceof RedisClusterNodeSnapshot) {
RedisClusterNodeSnapshot w1 = (RedisClusterNodeSnapshot) o1;
RedisClusterNodeSnapshot w2 = (RedisClusterNodeSnapshot) o2;
if (w1.getConnectedClients() != null && w2.getC... | 609 | 224 | 833 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/codec/Base16.java | Base16 | digest | class Base16 {
private static final char[] upper = "0123456789ABCDEF".toCharArray();
private static final char[] lower = "0123456789abcdef".toCharArray();
private static final byte[] decode = new byte[128];
static {
for (int i = 0; i < 10; i++) {
decode['0' + i] = (byte) i;
... |
try {
MessageDigest md = MessageDigest.getInstance("SHA1");
md.update(script);
return new String(Base16.encode(md.digest(), false));
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("JVM does not support SHA1");
}
| 538 | 84 | 622 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/codec/ByteArrayCodec.java | ByteArrayCodec | estimateSize | class ByteArrayCodec implements RedisCodec<byte[], byte[]>, ToByteBufEncoder<byte[], byte[]> {
public static final ByteArrayCodec INSTANCE = new ByteArrayCodec();
private static final byte[] EMPTY = new byte[0];
@Override
public void encodeKey(byte[] key, ByteBuf target) {
if (key != null) {... |
if (keyOrValue == null) {
return 0;
}
return ((byte[]) keyOrValue).length;
| 428 | 38 | 466 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/codec/ByteBufferInputStream.java | ByteBufferInputStream | read | class ByteBufferInputStream extends InputStream {
private final ByteBuffer buffer;
public ByteBufferInputStream(ByteBuffer b) {
this.buffer = b;
}
@Override
public int available() throws IOException {
return buffer.remaining();
}
@Override
public int read() throws IOE... |
if (buffer.remaining() > 0) {
return (buffer.get() & 0xFF);
}
return -1;
| 96 | 39 | 135 | <methods>public void <init>() ,public int available() throws java.io.IOException,public void close() throws java.io.IOException,public synchronized void mark(int) ,public boolean markSupported() ,public static java.io.InputStream nullInputStream() ,public abstract int read() throws java.io.IOException,public int read(b... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/codec/CipherCodec.java | KeyDescriptor | getName | class KeyDescriptor {
private static final KeyDescriptor UNNAMED = new KeyDescriptor("".getBytes(StandardCharsets.US_ASCII), 0);
private final byte[] name;
private final int version;
private KeyDescriptor(byte[] name, int version) {
for (byte b : name) {
... |
LettuceAssert.notNull(charset, "Charset must not be null");
return new String(name, charset);
| 1,199 | 35 | 1,234 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/codec/CompressionCodec.java | CompressionCodec | valueCompressor | class CompressionCodec {
private CompressionCodec() {
}
/**
* A {@link RedisCodec} that compresses values from a delegating {@link RedisCodec}.
*
* @param delegate codec used for key-value encoding/decoding, must not be {@code null}.
* @param compressionType the compression type, must ... |
LettuceAssert.notNull(delegate, "RedisCodec must not be null");
LettuceAssert.notNull(compressionType, "CompressionType must not be null");
return (RedisCodec) new CompressingValueCodecWrapper((RedisCodec) delegate, compressionType);
| 1,220 | 78 | 1,298 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/codec/StringCodec.java | StringCodec | encode | class StringCodec implements RedisCodec<String, String>, ToByteBufEncoder<String, String> {
public static final StringCodec UTF8 = new StringCodec(StandardCharsets.UTF_8);
public static final StringCodec ASCII = new StringCodec(StandardCharsets.US_ASCII);
private static final byte[] EMPTY = new byte[0];
... |
if (str == null) {
return;
}
if (utf8) {
ByteBufUtil.writeUtf8(target, str);
return;
}
if (ascii) {
ByteBufUtil.writeAscii(target, str);
return;
}
CharsetEncoder encoder = CharsetUtil.encoder(charset... | 1,096 | 285 | 1,381 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/AsyncExecutableCommand.java | AsyncExecutableCommand | dispatchCommand | class AsyncExecutableCommand implements ExecutableCommand {
private final CommandMethod commandMethod;
private final CommandFactory commandFactory;
private final StatefulConnection<Object, Object> connection;
AsyncExecutableCommand(CommandMethod commandMethod, CommandFactory commandFactory,
... |
AsyncCommand<Object, Object, Object> asyncCommand = new AsyncCommand<>(command);
if (commandMethod.isFutureExecution()) {
RedisCommand<Object, Object, Object> dispatched = connection.dispatch(asyncCommand);
if (dispatched instanceof AsyncCommand) {
return dis... | 252 | 255 | 507 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/AsyncExecutableCommandLookupStrategy.java | AsyncExecutableCommandLookupStrategy | resolveCommandMethod | class AsyncExecutableCommandLookupStrategy extends ExecutableCommandLookupStrategySupport {
private final StatefulConnection<Object, Object> connection;
public AsyncExecutableCommandLookupStrategy(List<RedisCodec<?, ?>> redisCodecs,
CommandOutputFactoryResolver commandOutputFactoryResolver, Comman... |
LettuceAssert.isTrue(!method.isReactiveExecution(),
() -> String.format("Command method %s not supported by this command lookup strategy", method));
CommandFactory commandFactory = super.resolveCommandFactory(method, metadata);
return new AsyncExecutableCommand(method, comman... | 168 | 80 | 248 | <methods>public void <init>(List<RedisCodec<?,?>>, io.lettuce.core.dynamic.output.CommandOutputFactoryResolver, io.lettuce.core.dynamic.CommandMethodVerifier) <variables>private final non-sealed io.lettuce.core.dynamic.CommandFactoryResolver commandFactoryResolver,private final non-sealed io.lettuce.core.dynamic.Comman... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/BatchExecutableCommand.java | BatchExecutableCommand | synchronize | class BatchExecutableCommand implements ExecutableCommand {
private final CommandMethod commandMethod;
private final CommandFactory commandFactory;
private final Batcher batcher;
private final StatefulConnection<Object, Object> connection;
private final ExecutionSpecificParameters parameters;
... |
if (batchTasks == BatchTasks.EMPTY) {
return null;
}
Duration timeout = connection.getTimeout();
BatchException exception = null;
List<RedisCommand<?, ?, ?>> failures = null;
for (RedisCommand<?, ?, ?> batchTask : batchTasks) {
try {
... | 439 | 202 | 641 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/BatchExecutableCommandLookupStrategy.java | BatchExecutableCommandLookupStrategy | resolveCommandMethod | class BatchExecutableCommandLookupStrategy extends ExecutableCommandLookupStrategySupport {
private final Set<Class<?>> SYNCHRONOUS_RETURN_TYPES = new HashSet<Class<?>>(Arrays.asList(Void.class, Void.TYPE));
private final Batcher batcher;
private final StatefulConnection<Object, Object> connection;
... |
LettuceAssert.isTrue(!method.isReactiveExecution(),
() -> String.format("Command method %s not supported by this command lookup strategy", method));
ExecutionSpecificParameters parameters = (ExecutionSpecificParameters) method.getParameters();
if (parameters.hasTimeoutIndex()... | 325 | 327 | 652 | <methods>public void <init>(List<RedisCodec<?,?>>, io.lettuce.core.dynamic.output.CommandOutputFactoryResolver, io.lettuce.core.dynamic.CommandMethodVerifier) <variables>private final non-sealed io.lettuce.core.dynamic.CommandFactoryResolver commandFactoryResolver,private final non-sealed io.lettuce.core.dynamic.Comman... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/CodecAwareMethodParametersAccessor.java | CodecAwareMethodParametersAccessor | isKey | class CodecAwareMethodParametersAccessor implements MethodParametersAccessor {
private final MethodParametersAccessor delegate;
private final TypeContext typeContext;
public CodecAwareMethodParametersAccessor(MethodParametersAccessor delegate, RedisCodec<?, ?> redisCodec) {
LettuceAssert.notNull... |
if (delegate.isValue(index)) {
return false;
}
if (delegate.isKey(index)) {
return true;
}
Object bindableValue = getBindableValue(index);
if (bindableValue != null && typeContext.keyType.getType().isAssignableFrom(bindableValue.getClass())) {... | 758 | 113 | 871 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/CommandSegmentCommandFactory.java | CommandSegmentCommandFactory | createCommand | class CommandSegmentCommandFactory implements CommandFactory {
private final CommandMethod commandMethod;
private final CommandSegments segments;
private final CommandOutputFactoryResolver outputResolver;
private final RedisCodec<Object, Object> redisCodec;
private final ParameterBinder paramet... |
MethodParametersAccessor parametersAccessor = new CodecAwareMethodParametersAccessor(
new DefaultMethodParametersAccessor(commandMethod.getParameters(), parameters), typeContext);
CommandArgs<Object, Object> args = new CommandArgs<>(redisCodec);
CommandOutput<Object, Object, ... | 516 | 150 | 666 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/ConversionService.java | ConversionService | findConverter | class ConversionService {
private Map<ConvertiblePair, Function<?, ?>> converterMap = new HashMap<>(10);
/**
* Register a converter {@link Function}.
*
* @param converter the converter.
*/
@SuppressWarnings("rawtypes")
public void addConverter(Function<?, ?> converter) {
L... |
LettuceAssert.notNull(source, "Source type must not be null");
LettuceAssert.notNull(target, "Target type must not be null");
for (ConvertiblePair pair : converterMap.keySet()) {
if (pair.getSourceType().isAssignableFrom(source) && target.isAssignableFrom(pair.getTargetType())) {
... | 905 | 124 | 1,029 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/ConvertingCommand.java | ConvertingCommand | execute | class ConvertingCommand implements ExecutableCommand {
private final ConversionService conversionService;
private final ExecutableCommand delegate;
public ConvertingCommand(ConversionService conversionService, ExecutableCommand delegate) {
this.conversionService = conversionService;
this.... |
Object result = delegate.execute(parameters);
if (delegate.getCommandMethod().getReturnType().isAssignableFrom(result.getClass())) {
return result;
}
return conversionService.convert(result, delegate.getCommandMethod().getReturnType().getRawClass());
| 141 | 77 | 218 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/DeclaredCommandMethod.java | DeclaredCommandMethod | equals | class DeclaredCommandMethod implements CommandMethod {
private final Method method;
private final ResolvableType returnType;
private final List<Class<?>> arguments = new ArrayList<>();
private final ExecutionSpecificParameters parameters;
private final ResolvableType actualReturnType;
priv... |
if (this == o)
return true;
if (!(o instanceof DeclaredCommandMethod))
return false;
DeclaredCommandMethod that = (DeclaredCommandMethod) o;
if (method != null ? !method.equals(that.method) : that.method != null)
return false;
if (returnType... | 1,295 | 141 | 1,436 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/DefaultCommandMethodVerifier.java | DefaultCommandMethodVerifier | validate | class DefaultCommandMethodVerifier implements CommandMethodVerifier {
/**
* Default maximum property distance: 2
*/
public static final int DEFAULT_MAX_DISTANCE = 2;
private List<CommandDetail> commandDetails;
/**
* Create a new {@link DefaultCommandMethodVerifier} given a {@link List}... |
LettuceAssert.notEmpty(commandSegments.getCommandType().name(), "Command name must not be empty");
CommandDetail commandDetail = findCommandDetail(commandSegments.getCommandType().name())
.orElseThrow(() -> syntaxException(commandSegments.getCommandType().name(), commandMethod));
... | 1,931 | 96 | 2,027 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/DefaultMethodParametersAccessor.java | DefaultMethodParametersAccessor | isBindableNullValue | class DefaultMethodParametersAccessor implements MethodParametersAccessor {
private final Parameters<? extends Parameter> parameters;
private final List<Object> values;
DefaultMethodParametersAccessor(Parameters<? extends Parameter> parameters, Object... values) {
LettuceAssert.notNull(parameter... |
Parameter bindableParameter = parameters.getBindableParameter(index);
if (bindableParameter.isAssignableTo(Limit.class) || bindableParameter.isAssignableTo(io.lettuce.core.Value.class)
|| bindableParameter.isAssignableTo(KeyValue.class) || bindableParameter.isAssignableTo(ScoredValue.... | 773 | 147 | 920 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/DefaultRedisCommandsMetadata.java | DefaultRedisCommandsMetadata | getMostSpecificMethod | class DefaultRedisCommandsMetadata implements RedisCommandsMetadata {
/** The package separator character: '.' */
private static final char PACKAGE_SEPARATOR = '.';
private final Class<?> apiInterface;
/**
* Create {@link DefaultRedisCommandsMetadata} given a {@link Class command interface}.
... |
if (method != null && isOverridable(method, targetClass) && targetClass != null
&& targetClass != method.getDeclaringClass()) {
try {
try {
return targetClass.getMethod(method.getName(), method.getParameterTypes());
} catch (NoSuc... | 1,159 | 112 | 1,271 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/ExecutableCommandLookupStrategySupport.java | DefaultCommandFactoryResolver | resolveRedisCommandFactory | class DefaultCommandFactoryResolver implements CommandFactoryResolver {
final AnnotationCommandSegmentFactory commandSegmentFactory = new AnnotationCommandSegmentFactory();
final AnnotationRedisCodecResolver codecResolver;
DefaultCommandFactoryResolver() {
codecResolver = new Anno... |
RedisCodec<?, ?> codec = codecResolver.resolve(commandMethod);
if (codec == null) {
throw new CommandCreationException(commandMethod, "Cannot resolve RedisCodec");
}
CodecAwareOutputFactoryResolver outputFactoryResolver = new CodecAwareOutputFactoryRes... | 124 | 154 | 278 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/ReactiveCommandSegmentCommandFactory.java | ReactiveCommandSegmentCommandFactory | resolveCommandOutputFactory | class ReactiveCommandSegmentCommandFactory extends CommandSegmentCommandFactory {
private boolean streamingExecution;
ReactiveCommandSegmentCommandFactory(CommandSegments commandSegments, CommandMethod commandMethod,
RedisCodec<?, ?> redisCodec, CommandOutputFactoryResolver outputResolver) {
... |
streamingExecution = ReactiveTypes.isMultiValueType(outputSelector.getOutputType().getRawClass());
OutputSelector componentType = new OutputSelector(outputSelector.getOutputType().getGeneric(0),
outputSelector.getRedisCodec());
if (streamingExecution) {
CommandOu... | 271 | 138 | 409 | <methods>public void <init>(io.lettuce.core.dynamic.segment.CommandSegments, io.lettuce.core.dynamic.CommandMethod, RedisCodec<?,?>, io.lettuce.core.dynamic.output.CommandOutputFactoryResolver) ,public RedisCommand<java.lang.Object,java.lang.Object,java.lang.Object> createCommand(java.lang.Object[]) <variables>private ... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/ReactiveExecutableCommand.java | ReactiveExecutableCommand | dispatch | class ReactiveExecutableCommand implements ExecutableCommand {
private final CommandMethod commandMethod;
private final ReactiveCommandSegmentCommandFactory commandFactory;
private final AbstractRedisReactiveCommands<Object, Object> redisReactiveCommands;
ReactiveExecutableCommand(CommandMethod comm... |
if (ReactiveTypes.isSingleValueType(commandMethod.getReturnType().getRawClass())) {
return redisReactiveCommands.createMono(() -> commandFactory.createCommand(arguments));
}
if (commandFactory.isStreamingExecution()) {
return redisReactiveCommands.createDissolvingFlux(... | 224 | 126 | 350 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/ReactiveExecutableCommandLookupStrategy.java | ReactiveExecutableCommandLookupStrategy | resolveCommandMethod | class ReactiveExecutableCommandLookupStrategy implements ExecutableCommandLookupStrategy {
private final AbstractRedisReactiveCommands<Object, Object> redisReactiveCommands;
private final ConversionService conversionService = new ConversionService();
private final List<RedisCodec<?, ?>> redisCodecs;
... |
LettuceAssert.isTrue(!method.isBatchExecution(),
() -> String.format("Command batching %s not supported with ReactiveExecutableCommandLookupStrategy", method));
LettuceAssert.isTrue(method.isReactiveExecution(),
() -> String.format("Command method %s not supported by R... | 614 | 156 | 770 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java | CompositeCommandLookupStrategy | getReactiveCommands | class CompositeCommandLookupStrategy implements ExecutableCommandLookupStrategy {
private final AsyncExecutableCommandLookupStrategy async;
private final ReactiveExecutableCommandLookupStrategy reactive;
CompositeCommandLookupStrategy() {
CommandMethodVerifier verifier = verifyCo... |
Object reactive = null;
if (connection instanceof StatefulRedisConnection) {
reactive = ((StatefulRedisConnection) connection).reactive();
}
if (connection instanceof StatefulRedisClusterConnection) {
reactive = ((StatefulRedisClusterCo... | 314 | 163 | 477 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java | SimpleBatcher | doFlush | class SimpleBatcher implements Batcher {
private final StatefulConnection<Object, Object> connection;
private final int batchSize;
private final BlockingQueue<RedisCommand<Object, Object, Object>> queue = new LinkedBlockingQueue<>();
private final AtomicBoolean flushing = new AtomicBoolean();
p... |
List<RedisCommand<Object, Object, Object>> commands = null;
if (forcedFlush) {
commands = prepareForceFlush();
} else if (defaultFlush) {
commands = prepareDefaultFlush(consume);
}
if (commands != null && !commands.isEmpty()) {
if (commands.... | 950 | 145 | 1,095 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/domain/Timeout.java | Timeout | create | class Timeout {
private final Duration timeout;
private Timeout(Duration timeout) {
LettuceAssert.notNull(timeout, "Timeout must not be null");
LettuceAssert.isTrue(!timeout.isNegative(), "Timeout must be greater or equal to zero");
this.timeout = timeout;
}
/**
* Creat... |
LettuceAssert.notNull(timeUnit, "TimeUnit must not be null");
return new Timeout(Duration.ofNanos(timeUnit.toNanos(timeout)));
| 287 | 50 | 337 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/intercept/DefaultMethodInvokingInterceptor.java | DefaultMethodInvokingInterceptor | lookupMethodHandle | class DefaultMethodInvokingInterceptor implements MethodInterceptor {
private final Map<Method, MethodHandle> methodHandleCache = new ConcurrentHashMap<>();
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
Method method = invocation.getMethod();
if (!method.... |
try {
return DefaultMethods.lookupMethodHandle(method);
} catch (ReflectiveOperationException e) {
throw new IllegalArgumentException(e);
}
| 234 | 45 | 279 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/intercept/InvocationProxyFactory.java | InvocationProxyFactory | createProxy | class InvocationProxyFactory {
private final List<MethodInterceptor> interceptors = new ArrayList<>();
private final List<Class<?>> interfaces = new ArrayList<>();
/**
* Create a proxy instance give a {@link ClassLoader}.
*
* @param classLoader must not be {@code null}.
* @param <T> i... |
LettuceAssert.notNull(classLoader, "ClassLoader must not be null");
Class<?>[] interfaces = this.interfaces.toArray(new Class[0]);
return (T) Proxy.newProxyInstance(classLoader, interfaces, new InterceptorChainInvocationHandler(interceptors));
| 531 | 80 | 611 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/intercept/MethodInterceptorChain.java | MethodInterceptorChain | invoke | class MethodInterceptorChain {
private final ThreadLocal<PooledMethodInvocation> pool = ThreadLocal.withInitial(PooledMethodInvocation::new);
final MethodInterceptorChain next;
MethodInterceptorChain(MethodInterceptorChain next) {
this.next = next;
}
/**
* Create a {@link MethodInte... |
PooledMethodInvocation invocation = getInvocation(target, method, args, next);
try {
// JIT hint
if (next instanceof MethodInterceptorContext) {
return next.proceed(invocation);
}
return next.proceed(invocation);
} finally {
... | 1,324 | 90 | 1,414 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/output/CommandOutputResolverSupport.java | CommandOutputResolverSupport | isAssignableFrom | class CommandOutputResolverSupport {
/**
* Overridable hook to check whether {@code selector} can be assigned from the provider type {@code provider}.
* <p>
* This method descends the component type hierarchy and considers primitive/wrapper type conversion.
*
* @param selector must not be ... |
ResolvableType selectorType = selector.getOutputType();
ResolvableType resolvableType = provider.withCodec(selector.getRedisCodec());
return selectorType.isAssignableFrom(resolvableType);
| 146 | 60 | 206 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/output/OutputRegistryCommandOutputFactoryResolver.java | OutputRegistryCommandOutputFactoryResolver | resolveStreamingCommandOutput | class OutputRegistryCommandOutputFactoryResolver extends CommandOutputResolverSupport
implements CommandOutputFactoryResolver {
@SuppressWarnings("rawtypes")
private static final ClassTypeInformation<CommandOutput> COMMAND_OUTPUT = ClassTypeInformation.from(CommandOutput.class);
private final Outp... |
Map<OutputType, CommandOutputFactory> registry = outputRegistry.getRegistry();
List<OutputType> outputTypes = registry.keySet().stream().filter(OutputType::isStreaming).collect(Collectors.toList());
List<OutputType> candidates = getCandidates(outputTypes, outputSelector);
if (candid... | 503 | 115 | 618 | <methods>public non-sealed void <init>() <variables> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/output/OutputType.java | OutputType | toString | class OutputType {
private final Class<? extends CommandOutput> commandOutputClass;
private final TypeInformation<?> typeInformation;
private final boolean streaming;
/**
* Create a new {@link OutputType} given {@code primaryType}, the {@code commandOutputClass}, {@link TypeInformation} and
... |
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [commandOutputClass=").append(commandOutputClass);
sb.append(", typeInformation=").append(typeInformation);
sb.append(", streaming=").append(streaming);
sb.append(']');
re... | 448 | 91 | 539 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/parameter/Parameter.java | Parameter | isAssignableTo | class Parameter {
private final ParameterNameDiscoverer discoverer = new CompositeParameterNameDiscoverer(
new StandardReflectionParameterNameDiscoverer(), new AnnotationParameterNameDiscoverer());
private final Method method;
private final String name;
private final int parameterIndex;
... |
LettuceAssert.notNull(target, "Target type must not be null");
return LettuceClassUtils.isAssignable(target, getParameterType());
| 937 | 45 | 982 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/parameter/Parameters.java | Parameters | createBindableParameters | class Parameters<P extends Parameter> implements Iterable<P> {
private final List<P> parameters;
private final List<P> bindableParameters;
/**
* Create new {@link Parameters} given a {@link Method}.
*
* @param method must not be {@code null}.
*/
public Parameters(Method method) {
... |
List<P> bindables = new ArrayList<>(parameters.size());
for (P parameter : parameters) {
if (parameter.isBindable()) {
bindables.add(parameter);
}
}
return bindables;
| 542 | 65 | 607 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/segment/AnnotationCommandSegmentFactory.java | AnnotationCommandSegmentFactory | getNamingStrategy | class AnnotationCommandSegmentFactory implements CommandSegmentFactory {
private static final Pattern SPACE = Pattern.compile("\\s");
private static final String INDEX_BASED_PARAM_START = "?";
private static final String NAME_BASED_PARAM_START = ":";
@Override
public CommandSegments createComman... |
if (commandMethod.hasAnnotation(CommandNaming.class)) {
Strategy strategy = commandMethod.getMethod().getAnnotation(CommandNaming.class).strategy();
if (strategy != Strategy.DEFAULT) {
return strategy;
}
}
Class<?> declaringClass = commandMe... | 1,388 | 156 | 1,544 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/segment/CommandSegment.java | CommandSegment | toString | class CommandSegment {
/**
* Create a constant {@link CommandSegment}.
*
* @param content must not be empty or {@code null}.
* @return the {@link CommandSegment}.
*/
public static CommandSegment constant(String content) {
return new Constant(content);
}
/**
* Crea... |
StringBuffer sb = new StringBuffer();
sb.append(getClass().getSimpleName());
sb.append(" ").append(asString());
return sb.toString();
| 967 | 47 | 1,014 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/segment/CommandSegments.java | StringCommandType | toString | class StringCommandType implements ProtocolKeyword {
private final byte[] commandTypeBytes;
private final String commandType;
StringCommandType(String commandType) {
this.commandType = commandType;
this.commandTypeBytes = commandType.getBytes();
}
@Ove... |
StringBuilder sb = new StringBuilder();
sb.append(getCommandType().name());
for (CommandSegment segment : segments) {
sb.append(' ').append(segment);
}
return sb.toString();
| 265 | 61 | 326 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/AnnotationParameterNameDiscoverer.java | AnnotationParameterNameDiscoverer | getParameterNames | class AnnotationParameterNameDiscoverer implements ParameterNameDiscoverer {
@Override
public String[] getParameterNames(Method method) {
if (method.getParameterCount() == 0) {
return new String[0];
}
return doGetParameterNames(method.getParameterAnnotations());
}
... |
if (ctor.getParameterCount() == 0) {
return new String[0];
}
return doGetParameterNames(ctor.getParameterAnnotations());
| 310 | 45 | 355 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/ClassTypeInformation.java | ClassTypeInformation | getUserClass | class ClassTypeInformation<S> extends TypeDiscoverer<S> {
public static final ClassTypeInformation<Collection> COLLECTION = new ClassTypeInformation(Collection.class);
public static final ClassTypeInformation<List> LIST = new ClassTypeInformation(List.class);
public static final ClassTypeInformation<Set>... |
if (clazz != null && clazz.getName().contains(LettuceClassUtils.CGLIB_CLASS_SEPARATOR)) {
Class<?> superclass = clazz.getSuperclass();
if (superclass != null && Object.class != superclass) {
return superclass;
}
}
return clazz;
| 1,353 | 90 | 1,443 | <methods>public boolean equals(java.lang.Object) ,public TypeInformation<?> getActualType() ,public final TypeInformation<?> getComponentType() ,public java.lang.reflect.Type getGenericType() ,public TypeInformation<?> getMapValueType() ,public List<TypeInformation<?>> getParameterTypes(Constructor<?>) ,public List<Typ... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/CompositeParameterNameDiscoverer.java | CompositeParameterNameDiscoverer | getParameterNames | class CompositeParameterNameDiscoverer implements ParameterNameDiscoverer {
private Collection<ParameterNameDiscoverer> parameterNameDiscoverers;
public CompositeParameterNameDiscoverer(ParameterNameDiscoverer... parameterNameDiscoverers) {
this(Arrays.asList(parameterNameDiscoverers));
}
pub... |
for (ParameterNameDiscoverer parameterNameDiscoverer : parameterNameDiscoverers) {
String[] parameterNames = parameterNameDiscoverer.getParameterNames(method);
if (parameterNames != null) {
return parameterNames;
}
}
return null;
| 254 | 74 | 328 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/GenericTypeResolver.java | GenericTypeResolver | resolveTypeArguments | class GenericTypeResolver {
/**
* Build a mapping of {@link TypeVariable#getName TypeVariable names} to {@link Class concrete classes} for the specified
* {@link Class}. Searches all super types, enclosing types and interfaces.
*/
@SuppressWarnings("rawtypes")
public static Map<TypeVariable,... |
ResolvableType type = ResolvableType.forClass(clazz).as(genericIfc);
if (!type.hasGenerics() || type.isEntirelyUnresolvable()) {
return null;
}
return type.resolveGenerics(Object.class);
| 614 | 71 | 685 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/ParametrizedTypeInformation.java | ParametrizedTypeInformation | isAssignableFrom | class ParametrizedTypeInformation<T> extends ParentTypeAwareTypeInformation<T> {
private final ParameterizedType type;
private Boolean resolved;
/**
* Creates a new {@link ParametrizedTypeInformation} for the given {@link Type} and parent {@link TypeDiscoverer}.
*
* @param type must not be... |
if (this.equals(target)) {
return true;
}
Class<T> rawType = getType();
Class<?> rawTargetType = target.getType();
if (!rawType.isAssignableFrom(rawTargetType)) {
return false;
}
TypeInformation<?> otherTypeInformation = rawType.equals... | 1,062 | 337 | 1,399 | <methods>public boolean equals(java.lang.Object) ,public int hashCode() <variables>private int hashCode,private final non-sealed TypeDiscoverer<?> parent |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/ParentTypeAwareTypeInformation.java | ParentTypeAwareTypeInformation | equals | class ParentTypeAwareTypeInformation<S> extends TypeDiscoverer<S> {
private final TypeDiscoverer<?> parent;
private int hashCode;
/**
* Creates a new {@link ParentTypeAwareTypeInformation}.
*
* @param type must not be {@code null}.
* @param parent must not be {@code null}.
* @par... |
if (!super.equals(obj)) {
return false;
}
if (!this.getClass().equals(obj.getClass())) {
return false;
}
ParentTypeAwareTypeInformation<?> that = (ParentTypeAwareTypeInformation<?>) obj;
return this.parent == null ? that.parent == null : this.p... | 488 | 101 | 589 | <methods>public boolean equals(java.lang.Object) ,public TypeInformation<?> getActualType() ,public final TypeInformation<?> getComponentType() ,public java.lang.reflect.Type getGenericType() ,public TypeInformation<?> getMapValueType() ,public List<TypeInformation<?>> getParameterTypes(Constructor<?>) ,public List<Typ... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/StandardReflectionParameterNameDiscoverer.java | StandardReflectionParameterNameDiscoverer | getParameterNames | class StandardReflectionParameterNameDiscoverer implements ParameterNameDiscoverer {
@Override
public String[] getParameterNames(Method method) {
Parameter[] parameters = method.getParameters();
String[] parameterNames = new String[parameters.length];
for (int i = 0; i < parameters.leng... |
Parameter[] parameters = ctor.getParameters();
String[] parameterNames = new String[parameters.length];
for (int i = 0; i < parameters.length; i++) {
Parameter param = parameters[i];
if (!param.isNamePresent()) {
return null;
}
par... | 171 | 99 | 270 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/TypeVariableTypeInformation.java | TypeVariableTypeInformation | equals | class TypeVariableTypeInformation<T> extends ParentTypeAwareTypeInformation<T> {
private final TypeVariable<?> variable;
private final Type owningType;
/**
* Creates a bew {@link TypeVariableTypeInformation} for the given {@link TypeVariable} owning {@link Type} and parent
* {@link TypeDiscover... |
if (obj == this) {
return true;
}
if (!(obj instanceof TypeVariableTypeInformation)) {
return false;
}
TypeVariableTypeInformation<?> that = (TypeVariableTypeInformation<?>) obj;
return getType().equals(that.getType());
| 708 | 80 | 788 | <methods>public boolean equals(java.lang.Object) ,public int hashCode() <variables>private int hashCode,private final non-sealed TypeDiscoverer<?> parent |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/TypeWrapper.java | MethodInvokeTypeProvider | getType | class MethodInvokeTypeProvider implements TypeProvider {
private final TypeProvider provider;
private final String methodName;
private final int index;
private transient Method method;
private transient volatile Object result;
public MethodInvokeTypeProvider(TypePro... |
Object result = this.result;
if (result == null) {
// Lazy invocation of the target method on the provided type
result = ReflectionUtils.invokeMethod(this.method, this.provider.getType());
// Cache the result for further calls to getType()
... | 163 | 107 | 270 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/dynamic/support/WildcardTypeInformation.java | WildcardTypeInformation | isAssignableFrom | class WildcardTypeInformation<S> extends TypeDiscoverer<S> {
private final WildcardType type;
/**
* Creates a new {@link WildcardTypeInformation} for the given type, type variable map.
*
* @param type must not be {@code null}.
* @param typeVariableMap must not be {@code null}.
*/
... |
for (TypeInformation<?> lowerBound : getLowerBounds()) {
if (!target.isAssignableFrom(lowerBound)) {
return false;
}
}
for (TypeInformation<?> upperBound : getUpperBounds()) {
if (!upperBound.isAssignableFrom(target)) {
retur... | 324 | 100 | 424 | <methods>public boolean equals(java.lang.Object) ,public TypeInformation<?> getActualType() ,public final TypeInformation<?> getComponentType() ,public java.lang.reflect.Type getGenericType() ,public TypeInformation<?> getMapValueType() ,public List<TypeInformation<?>> getParameterTypes(Constructor<?>) ,public List<Typ... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/event/DefaultEventBus.java | DefaultEventBus | publish | class DefaultEventBus implements EventBus {
private final Sinks.Many<Event> bus;
private final Scheduler scheduler;
private final EventRecorder recorder = EventRecorder.getInstance();
public DefaultEventBus(Scheduler scheduler) {
this.bus = Sinks.many().multicast().directBestEffort();
... |
recorder.record(event);
Sinks.EmitResult emitResult;
while ((emitResult = bus.tryEmitNext(event)) == Sinks.EmitResult.FAIL_NON_SERIALIZED) {
// busy-loop
}
if (emitResult != Sinks.EmitResult.FAIL_ZERO_SUBSCRIBER) {
emitResult.orThrow();
}
| 170 | 111 | 281 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/event/DefaultEventPublisherOptions.java | Builder | eventEmitInterval | class Builder {
private Duration eventEmitInterval = DEFAULT_EMIT_INTERVAL_DURATION;
private Builder() {
}
/**
* Sets the emit interval and the interval unit. Event emission will be disabled if the {@code eventEmitInterval} is set
* to 0}. Defaults to 10} {@link Time... |
LettuceAssert.notNull(eventEmitInterval, "EventEmitInterval must not be null");
LettuceAssert.isTrue(!eventEmitInterval.isNegative(), "EventEmitInterval must be greater or equal to 0");
this.eventEmitInterval = eventEmitInterval;
return this;
| 556 | 82 | 638 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/event/command/CommandBaseEvent.java | CommandBaseEvent | toString | class CommandBaseEvent {
private final RedisCommand<Object, Object, Object> command;
private final Map<String, Object> context;
protected CommandBaseEvent(RedisCommand<Object, Object, Object> command, Map<String, Object> context) {
this.command = command;
this.context = context;
}
... |
StringBuffer sb = new StringBuffer();
sb.append(getClass().getSimpleName());
sb.append(" [command=").append(command);
sb.append(", context=").append(context);
sb.append(']');
return sb.toString();
| 200 | 69 | 269 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/event/connection/ConnectionEventSupport.java | ConnectionEventSupport | toString | class ConnectionEventSupport implements ConnectionEvent {
private final String redisUri;
private final String epId;
private final String channelId;
private final SocketAddress local;
private final SocketAddress remote;
ConnectionEventSupport(SocketAddress local, SocketAddress remote) {
... |
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append(local);
sb.append(" -> ").append(remote);
sb.append(']');
return sb.toString();
| 428 | 71 | 499 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/event/jfr/JfrEventRecorder.java | JfrEventRecorder | createEvent | class JfrEventRecorder implements EventRecorder {
private final Map<Class<?>, Constructor<?>> constructorMap = new HashMap<>();
@Override
public void record(Event event) {
LettuceAssert.notNull(event, "Event must not be null");
jdk.jfr.Event jfrEvent = createEvent(event);
if (jf... |
try {
Constructor<?> constructor = getEventConstructor(event);
if (constructor.getDeclaringClass() == Object.class) {
return null;
}
return (jdk.jfr.Event) constructor.newInstance(event);
} catch (ReflectiveOperationException e) {
... | 585 | 95 | 680 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/event/metrics/DefaultCommandLatencyEventPublisher.java | DefaultCommandLatencyEventPublisher | shutdown | class DefaultCommandLatencyEventPublisher implements MetricEventPublisher {
private final EventExecutorGroup eventExecutorGroup;
private final EventPublisherOptions options;
private final EventBus eventBus;
private final CommandLatencyCollector commandLatencyCollector;
private final Runnable EM... |
if (scheduledFuture != null) {
scheduledFuture.cancel(true);
scheduledFuture = null;
}
| 398 | 35 | 433 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/AbstractInvocationHandler.java | MethodTranslator | createMethodMap | class MethodTranslator {
private static final WeakHashMap<Class<?>, MethodTranslator> TRANSLATOR_MAP = new WeakHashMap<>(32);
private final Map<Method, Method> map;
private MethodTranslator(Class<?> delegate, Class<?>... methodSources) {
map = createMethodMap(delegate, methodSour... |
Map<Method, Method> map;
List<Method> methods = new ArrayList<>();
for (Class<?> sourceClass : methodSources) {
methods.addAll(getMethods(sourceClass));
}
map = new HashMap<>(methods.size(), 1.0f);
for (Method method : methods) ... | 571 | 140 | 711 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/AsyncConnectionProvider.java | AsyncConnectionProvider | getSynchronizer | class AsyncConnectionProvider<K, T extends AsyncCloseable, F extends CompletionStage<T>> {
private final Function<K, F> connectionFactory;
private final Map<K, Sync<K, T, F>> connections = new ConcurrentHashMap<>();
private volatile boolean closed;
/**
* Create a new {@link AsyncConnectionProvi... |
if (closed) {
throw new IllegalStateException("ConnectionProvider is already closed");
}
Sync<K, T, F> sync = connections.get(key);
if (sync != null) {
return sync;
}
AtomicBoolean atomicBoolean = new AtomicBoolean();
sync = connectio... | 1,754 | 226 | 1,980 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/DefaultMethods.java | DefaultMethods | getLookup | class DefaultMethods {
private static final MethodHandleLookup methodHandleLookup = MethodHandleLookup.getMethodHandleLookup();
/**
* Lookup a {@link MethodHandle} for a default {@link Method}.
*
* @param method must be a {@link Method#isDefault() default} {@link Method}.
* @return the {@l... |
Lookup lookup = MethodHandles.lookup();
if (privateLookupIn != null) {
try {
return (Lookup) privateLookupIn.invoke(null, declaringClass, lookup);
} catch (ReflectiveOperationException e) {
return ... | 1,068 | 87 | 1,155 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/ExceptionFactory.java | ExceptionFactory | isExactSeconds | class ExceptionFactory {
private static final DateTimeFormatter MINUTES = new DateTimeFormatterBuilder().appendText(ChronoField.MINUTE_OF_DAY)
.appendLiteral(" minute(s)").toFormatter();
private static final DateTimeFormatter SECONDS = new DateTimeFormatterBuilder().appendText(ChronoField.SECOND_O... |
return duration.toMillis() % (1000) == 0 && duration.getNano() == 0;
| 1,162 | 31 | 1,193 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/Exceptions.java | Exceptions | fromSynchronization | class Exceptions {
/**
* Unwrap the exception if the given {@link Throwable} is a {@link ExecutionException} or {@link CompletionException}.
*
* @param t the root cause
* @return the unwrapped {@link Throwable#getCause() cause} or the actual {@link Throwable}.
*/
public static Throwabl... |
Throwable throwableToUse = unwrap(t);
if (throwableToUse instanceof RedisCommandTimeoutException) {
return new RedisCommandTimeoutException(throwableToUse);
}
if (throwableToUse instanceof RedisCommandExecutionException) {
return bubble(throwableToUse);
... | 537 | 125 | 662 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/Futures.java | Futures | failed | class Futures {
private Futures() {
// no instances allowed
}
/**
* Create a composite {@link CompletableFuture} is composed from the given {@code stages}.
*
* @param stages must not be {@code null}.
* @return the composed {@link CompletableFuture}.
* @since 5.1.1
*/
... |
LettuceAssert.notNull(throwable, "Throwable must not be null");
CompletableFuture<T> future = new CompletableFuture<>();
future.completeExceptionally(throwable);
return future;
| 1,911 | 59 | 1,970 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/HostAndPort.java | HostAndPort | parse | class HostAndPort {
private static final int NO_PORT = -1;
public final String hostText;
public final int port;
/**
*
* @param hostText must not be empty or {@code null}.
* @param port
*/
private HostAndPort(String hostText, int port) {
LettuceAssert.notNull(hostText,... |
LettuceAssert.notNull(hostPortString, "HostPortString must not be null");
String host;
String portString = null;
if (hostPortString.startsWith("[")) {
String[] hostAndPort = getHostAndPortFromBracketedHost(hostPortString);
host = hostAndPort[0];
por... | 1,603 | 435 | 2,038 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/LettuceClassUtils.java | LettuceClassUtils | getDefaultClassLoader | class LettuceClassUtils {
/** The CGLIB class separator character "$$" */
public static final String CGLIB_CLASS_SEPARATOR = "$$";
/**
* Map with primitive wrapper type as key and corresponding primitive type as value, for example: Integer.class ->
* int.class.
*/
private static final M... |
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (Throwable ex) {
// Cannot access thread context ClassLoader - falling back to system class loader...
}
if (cl == null) {
// No thread context class load... | 1,295 | 109 | 1,404 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/LettuceFactories.java | LettuceFactories | newConcurrentQueue | class LettuceFactories {
/**
* Threshold used to determine queue implementation. A queue size above the size indicates usage of
* {@link LinkedBlockingQueue} otherwise {@link ArrayBlockingQueue}.
*/
private static final int ARRAY_QUEUE_THRESHOLD = Integer
.getInteger("io.lettuce.core... |
if (maxSize == Integer.MAX_VALUE) {
return new ConcurrentLinkedQueue<>();
}
return maxSize > ARRAY_QUEUE_THRESHOLD ? new LinkedBlockingQueue<>(maxSize) : new ArrayBlockingQueue<>(maxSize);
| 372 | 71 | 443 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/LettuceLists.java | LettuceLists | newList | class LettuceLists {
/**
* prevent instances.
*/
private LettuceLists() {
}
/**
* Creates a new {@link ArrayList} containing all elements from {@code elements}.
*
* @param elements the elements that the list should contain, must not be {@code null}.
* @param <T> the eleme... |
LettuceAssert.notNull(elements, "Iterable must not be null");
if (elements instanceof Collection<?>) {
return new ArrayList<>((Collection<? extends T>) elements);
}
return newList(elements.iterator());
| 751 | 66 | 817 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/LettuceSets.java | LettuceSets | newHashSet | class LettuceSets {
/**
* prevent instances.
*/
private LettuceSets() {
}
/**
* Creates a new {@code HashSet} containing all elements from {@code elements}.
*
* @param elements the elements that the set should contain, must not be {@code null}.
* @param <T> the element t... |
LettuceAssert.notNull(elements, "Iterable must not be null");
if (elements instanceof Collection<?>) {
return newHashSet((Collection<T>) elements);
}
Set<T> set = new HashSet<>();
for (T e : elements) {
set.add(e);
}
return set;
| 629 | 93 | 722 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/LettuceStrings.java | LettuceStrings | isEmpty | class LettuceStrings {
/**
* Utility constructor.
*/
private LettuceStrings() {
}
/**
* Checks if a String is empty or null.
*
* @param cs the char sequence
* @return true if empty
* @since 6.0.3
* @see String#isEmpty()
*/
public static boolean isEmpty... |
if (cs instanceof String) {
return isEmpty((String) cs);
}
return cs == null || cs.length() == 0;
| 1,456 | 42 | 1,498 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/internal/TimeoutProvider.java | TimeoutProvider | getTimeoutNs | class TimeoutProvider {
private final Supplier<TimeoutOptions> timeoutOptionsSupplier;
private final LongSupplier defaultTimeoutSupplier;
private State state;
/**
* Creates a new {@link TimeoutProvider} given {@link TimeoutOptions supplier} and {@link LongSupplier default timeout
* supplie... |
long timeoutNs = -1;
State state = this.state;
if (state == null) {
state = this.state = new State(timeoutOptionsSupplier.get());
}
if (!state.applyDefaultTimeout) {
timeoutNs = state.timeoutSource.getTimeUnit().toNanos(state.timeoutSource.getTimeout(c... | 459 | 122 | 581 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/AsyncConnections.java | AsyncConnections | asMono | class AsyncConnections {
private final Map<RedisURI, CompletableFuture<StatefulRedisConnection<String, String>>> connections = new TreeMap<>(
ReplicaUtils.RedisURIComparator.INSTANCE);
private final List<RedisNodeDescription> nodeList;
AsyncConnections(List<RedisNodeDescription> nodeList) {
... |
Connections connections = new Connections(this.connections.size(), nodeList);
for (Map.Entry<RedisURI, CompletableFuture<StatefulRedisConnection<String, String>>> entry : this.connections
.entrySet()) {
CompletableFuture<StatefulRedisConnection<String, String>> future = e... | 227 | 182 | 409 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/AutodiscoveryConnector.java | AutodiscoveryConnector | connectAsync | class AutodiscoveryConnector<K, V> implements MasterReplicaConnector<K, V> {
private final RedisClient redisClient;
private final RedisCodec<K, V> codec;
private final RedisURI redisURI;
private final Map<RedisURI, StatefulRedisConnection<?, ?>> initialConnections = new ConcurrentHashMap<>();
A... |
ConnectionFuture<StatefulRedisConnection<K, V>> initialConnection = redisClient.connectAsync(codec, redisURI);
Mono<StatefulRedisMasterReplicaConnection<K, V>> connect = Mono.fromCompletionStage(initialConnection)
.flatMap(nodeConnection -> {
initialConnections.put... | 1,113 | 315 | 1,428 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/CompletableEventLatchSupport.java | CompletableEventLatchSupport | emit | class CompletableEventLatchSupport<T, V> {
@SuppressWarnings("rawtypes")
private static final AtomicIntegerFieldUpdater<CompletableEventLatchSupport> NOTIFICATIONS_UPDATER = AtomicIntegerFieldUpdater
.newUpdater(CompletableEventLatchSupport.class, "notifications");
@SuppressWarnings("rawtypes"... |
if (GATE_UPDATER.compareAndSet(this, GATE_OPEN, GATE_CLOSED)) {
onEmit(new Emission<V>() {
@Override
public void success(V value) {
selfFuture.complete(value);
}
@Override
public void error(Throw... | 1,117 | 115 | 1,232 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/Connections.java | Connections | closeAsync | class Connections extends CompletableEventLatchSupport<Tuple2<RedisURI, StatefulRedisConnection<String, String>>, Connections>
implements AsyncCloseable {
private final Lock lock = new ReentrantLock();
private final Map<RedisURI, StatefulRedisConnection<String, String>> connections = new TreeMap<>(
... |
List<CompletableFuture<?>> close = new ArrayList<>(this.connections.size());
List<RedisURI> toRemove = new ArrayList<>(this.connections.size());
this.closed = true;
for (Map.Entry<RedisURI, StatefulRedisConnection<String, String>> entry : this.connections.entrySet()) {
t... | 908 | 165 | 1,073 | <methods>public void <init>(int) ,public final void accept(Tuple2<io.lettuce.core.RedisURI,StatefulRedisConnection<java.lang.String,java.lang.String>>) ,public final void accept(java.lang.Throwable) ,public final int getExpectedCount() ,public final CompletionStage<io.lettuce.core.masterreplica.Connections> getOrTimeou... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/MasterReplicaChannelWriter.java | MasterReplicaChannelWriter | closeAsync | class MasterReplicaChannelWriter implements RedisChannelWriter {
private MasterReplicaConnectionProvider<?, ?> masterReplicaConnectionProvider;
private final ClientResources clientResources;
private final ClientOptions clientOptions;
private final io.lettuce.core.protocol.ReadOnlyCommands.ReadOnlyPr... |
if (closed) {
return CompletableFuture.completedFuture(null);
}
closed = true;
CompletableFuture<Void> future = null;
if (masterReplicaConnectionProvider != null) {
future = masterReplicaConnectionProvider.closeAsync();
masterReplicaConnec... | 1,864 | 122 | 1,986 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/MasterReplicaTopologyRefresh.java | MasterReplicaTopologyRefresh | getConnections | class MasterReplicaTopologyRefresh {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(MasterReplicaTopologyRefresh.class);
private static final StringCodec CODEC = StringCodec.UTF8;
private final NodeConnectionFactory nodeConnectionFactory;
private final TopologyProvide... |
List<RedisNodeDescription> nodeList = LettuceLists.newList(nodes);
AsyncConnections connections = new AsyncConnections(nodeList);
for (RedisNodeDescription node : nodeList) {
RedisURI redisURI = node.getUri();
String message = String.format("Unable to connect to %s", ... | 651 | 381 | 1,032 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/RedisMasterReplicaNode.java | RedisMasterReplicaNode | toString | class RedisMasterReplicaNode implements RedisNodeDescription {
private final RedisURI redisURI;
private final Role role;
RedisMasterReplicaNode(String host, int port, RedisURI seed, Role role) {
this.redisURI = RedisURI.builder(seed).withHost(host).withPort(port).build();
this.role = rol... |
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [redisURI=").append(redisURI);
sb.append(", role=").append(role);
sb.append(']');
return sb.toString();
| 325 | 73 | 398 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/ReplicaTopologyProvider.java | ReplicaTopologyProvider | getMasterFromInfo | class ReplicaTopologyProvider implements TopologyProvider {
public static final Pattern ROLE_PATTERN = Pattern.compile("^role\\:([a-z]+)$", Pattern.MULTILINE);
public static final Pattern SLAVE_PATTERN = Pattern.compile("^slave(\\d+)\\:([a-zA-Z\\,\\=\\d\\.\\:\\-]+)$",
Pattern.MULTILINE);
publ... |
Matcher masterHostMatcher = MASTER_HOST_PATTERN.matcher(info);
Matcher masterPortMatcher = MASTER_PORT_PATTERN.matcher(info);
boolean foundHost = masterHostMatcher.find();
boolean foundPort = masterPortMatcher.find();
if (!foundHost || !foundPort) {
throw new Ille... | 1,457 | 176 | 1,633 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/ReplicaUtils.java | ReplicaUtils | compare | class ReplicaUtils {
/**
* Check if properties changed.
*
* @param o1 the first object to be compared.
* @param o2 the second object to be compared.
* @return {@code true} if {@code MASTER} or {@code SLAVE} flags changed or the URIs are changed.
*/
static boolean isChanged(Collect... |
String h1 = "";
String h2 = "";
if (o1 != null) {
h1 = o1.getHost() + ":" + o1.getPort();
}
if (o2 != null) {
h2 = o2.getHost() + ":" + o2.getPort();
}
return h1.compareToIgnoreCase(h2);
| 774 | 104 | 878 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/Requests.java | Requests | onEmit | class Requests extends
CompletableEventLatchSupport<Tuple2<RedisURI, TimedAsyncCommand<String, String, String>>, List<RedisNodeDescription>> {
private final Map<RedisURI, TimedAsyncCommand<String, String, String>> rawViews = new TreeMap<>(
ReplicaUtils.RedisURIComparator.INSTANCE);
private... |
List<RedisNodeDescription> result = new ArrayList<>();
Map<RedisNodeDescription, Long> latencies = new HashMap<>();
for (RedisNodeDescription node : nodes) {
TimedAsyncCommand<String, String, String> future = getRequest(node.getUri());
if (future == null || !future.... | 359 | 197 | 556 | <methods>public void <init>(int) ,public final void accept(Tuple2<io.lettuce.core.RedisURI,TimedAsyncCommand<java.lang.String,java.lang.String,java.lang.String>>) ,public final void accept(java.lang.Throwable) ,public final int getExpectedCount() ,public final CompletionStage<List<io.lettuce.core.models.role.RedisNodeD... |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/ResumeAfter.java | ResumeAfter | thenError | class ResumeAfter {
private static final AtomicIntegerFieldUpdater<ResumeAfter> UPDATER = AtomicIntegerFieldUpdater
.newUpdater(ResumeAfter.class, "closed");
private final AsyncCloseable closeable;
private static final int ST_OPEN = 0;
private static final int ST_CLOSED = 1;
@Suppre... |
return Mono.defer(() -> {
if (firstCloseLatch()) {
return Mono.fromCompletionStage(closeable.closeAsync());
}
return Mono.empty();
}).then(Mono.<T> error(t)).doFinally(s -> {
if (firstCloseLatch()) {
closeable.closeAsy... | 379 | 106 | 485 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/SentinelConnector.java | SentinelConnector | getTopologyRefreshRunnable | class SentinelConnector<K, V> implements MasterReplicaConnector<K, V> {
private static final InternalLogger LOG = InternalLoggerFactory.getInstance(SentinelConnector.class);
private final RedisClient redisClient;
private final RedisCodec<K, V> codec;
private final RedisURI redisURI;
SentinelCon... |
return () -> {
try {
LOG.debug("Refreshing topology");
refresh.getNodes(redisURI).subscribe(nodes -> {
EventRecorder.getInstance().record(new MasterReplicaTopologyChangedEvent(redisURI, nodes));
if (nodes.isEmpty()) {
... | 872 | 175 | 1,047 | <no_super_class> |
redis_lettuce | lettuce/src/main/java/io/lettuce/core/masterreplica/SentinelTopologyProvider.java | SentinelTopologyProvider | getNodesAsync | class SentinelTopologyProvider implements TopologyProvider {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(SentinelTopologyProvider.class);
private final String masterId;
private final RedisClient redisClient;
private final RedisURI sentinelUri;
private final Du... |
logger.debug("lookup topology for masterId {}", masterId);
Mono<StatefulRedisSentinelConnection<String, String>> connect = Mono
.fromFuture(redisClient.connectSentinelAsync(StringCodec.UTF8, sentinelUri));
return connect.flatMap(this::getNodes).toFuture();
| 901 | 89 | 990 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.