Skip to content

Commit

Permalink
Merge branch 'master' into toString
Browse files Browse the repository at this point in the history
  • Loading branch information
jjz921024 authored Aug 6, 2024
2 parents 952da8d + e14b899 commit ccbf4e0
Show file tree
Hide file tree
Showing 156 changed files with 9,155 additions and 1,189 deletions.
24 changes: 15 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<jedis.module.name>redis.clients.jedis</jedis.module.name>
<slf4j.version>1.7.36</slf4j.version>
<resilience4j.version>1.7.1</resilience4j.version>
<jackson.version>2.17.0</jackson.version>
<jackson.version>2.17.2</jackson.version>
<maven.surefire.version>3.2.5</maven.surefire.version>
</properties>

Expand All @@ -72,14 +72,14 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.11.0</version>
</dependency>

<!-- UNIX socket connection support -->
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-core</artifactId>
<version>2.9.0</version>
<version>2.10.0</version>
<type>pom</type>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -133,6 +133,12 @@
<version>2.38.0</version> <!-- 3.x requires Java 17 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5-fluent</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>

<!-- circuit breaker / failover -->
<dependency>
Expand Down Expand Up @@ -177,7 +183,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<version>0.8.12</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -216,7 +222,7 @@
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<configuration>
<attach>true</attach>
</configuration>
Expand All @@ -231,7 +237,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<version>3.7.0</version>
<configuration>
<source>8</source><!-- Until JDK 11+ -->
<detectJavaApiLink>false</detectJavaApiLink><!-- Until JDK 11+ -->
Expand All @@ -254,7 +260,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<version>1.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand All @@ -272,7 +278,7 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
Expand Down Expand Up @@ -306,7 +312,7 @@
<!--Sign the components - this is required by maven central for releases -->
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.2</version>
<version>3.2.4</version>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/redis/clients/jedis/AbstractTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,12 @@ protected AbstractTransaction(CommandObjects commandObjects) {
public Response<Long> waitReplicas(int replicas, long timeout) {
return appendCommand(commandObjects.waitReplicas(replicas, timeout));
}

public Response<Long> publish(String channel, String message) {
return appendCommand(commandObjects.publish(channel, message));
}

public Response<Long> publish(byte[] channel, byte[] message) {
return appendCommand(commandObjects.publish(channel, message));
}
}
2 changes: 2 additions & 0 deletions src/main/java/redis/clients/jedis/BuilderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ public String toString() {
}
};

@Deprecated
public static final Builder<Set<Tuple>> TUPLE_ZSET = new Builder<Set<Tuple>>() {
@Override
@SuppressWarnings("unchecked")
Expand All @@ -683,6 +684,7 @@ public String toString() {
}
};

@Deprecated
public static final Builder<Set<Tuple>> TUPLE_ZSET_RESP3 = new Builder<Set<Tuple>>() {
@Override
@SuppressWarnings("unchecked")
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/redis/clients/jedis/ClusterPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ private static ClusterCommandObjects createClusterCommandObjects(RedisProtocol p
return cco;
}

/**
* This method must be called after constructor, if graph commands are going to be used.
*/
public void prepareGraphCommands() {
super.prepareGraphCommands(provider);
}

@Override
public void close() {
try {
Expand All @@ -65,10 +72,11 @@ protected Connection getConnection(HostAndPort nodeKey) {
return provider.getConnection(nodeKey);
}

/**
* This method must be called after constructor, if graph commands are going to be used.
*/
public void prepareGraphCommands() {
super.prepareGraphCommands(provider);
public Response<Long> spublish(String channel, String message) {
return appendCommand(commandObjects.spublish(channel, message));
}

public Response<Long> spublish(byte[] channel, byte[] message) {
return appendCommand(commandObjects.spublish(channel, message));
}
}
42 changes: 36 additions & 6 deletions src/main/java/redis/clients/jedis/CommandArguments.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package redis.clients.jedis;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;

Expand Down Expand Up @@ -29,19 +30,50 @@ public ProtocolCommand getCommand() {
return (ProtocolCommand) args.get(0);
}

public CommandArguments add(Rawable arg) {
args.add(arg);
return this;
}

public CommandArguments add(byte[] arg) {
return add(RawableFactory.from(arg));
}

public CommandArguments add(boolean arg) {
return add(RawableFactory.from(arg));
}

public CommandArguments add(int arg) {
return add(RawableFactory.from(arg));
}

public CommandArguments add(long arg) {
return add(RawableFactory.from(arg));
}

public CommandArguments add(double arg) {
return add(RawableFactory.from(arg));
}

public CommandArguments add(String arg) {
return add(RawableFactory.from(arg));
}

public CommandArguments add(Object arg) {
if (arg == null) {
throw new IllegalArgumentException("null is not a valid argument.");
} else if (arg instanceof Rawable) {
args.add((Rawable) arg);
} else if (arg instanceof byte[]) {
args.add(RawableFactory.from((byte[]) arg));
} else if (arg instanceof Boolean) {
args.add(RawableFactory.from((Boolean) arg));
} else if (arg instanceof Integer) {
args.add(RawableFactory.from((Integer) arg));
} else if (arg instanceof Long) {
args.add(RawableFactory.from((Long) arg));
} else if (arg instanceof Double) {
args.add(RawableFactory.from((Double) arg));
} else if (arg instanceof Boolean) {
args.add(RawableFactory.from((Boolean) arg ? 1 : 0));
} else if (arg instanceof float[]) {
args.add(RawableFactory.from(RediSearchUtil.toByteArray((float[]) arg)));
} else if (arg instanceof String) {
Expand Down Expand Up @@ -87,14 +119,12 @@ public CommandArguments key(Object key) {
}

public final CommandArguments keys(Object... keys) {
for (Object key : keys) {
key(key);
}
Arrays.stream(keys).forEach(this::key);
return this;
}

public final CommandArguments keys(Collection keys) {
keys.forEach(key -> key(key));
keys.forEach(this::key);
return this;
}

Expand Down
Loading

0 comments on commit ccbf4e0

Please sign in to comment.