-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support report libname and libver to Redis (#3356)
* Support report libname and libver to Redis #3338 Co-authored-by: M Sazzadul Hoque <[email protected]> * Refactor ClientAttributeOption Co-authored-by: M Sazzadul Hoque <[email protected]> * Apply suggestions from code review * Keep select() * Update src/main/java/redis/clients/jedis/Connection.java Co-authored-by: M Sazzadul Hoque <[email protected]> --------- Co-authored-by: M Sazzadul Hoque <[email protected]>
- Loading branch information
1 parent
58f5761
commit 5192937
Showing
10 changed files
with
164 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/redis/clients/jedis/args/ClientAttributeOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package redis.clients.jedis.args; | ||
|
||
import redis.clients.jedis.util.SafeEncoder; | ||
|
||
/** | ||
* CLIENT SETINFO command attr option | ||
* since redis 7.2 | ||
*/ | ||
public enum ClientAttributeOption implements Rawable { | ||
LIB_NAME("LIB-NAME"), | ||
LIB_VER("LIB-VER"); | ||
|
||
private final byte[] raw; | ||
|
||
private ClientAttributeOption(String str) { | ||
this.raw = SafeEncoder.encode(str); | ||
} | ||
|
||
@Override | ||
public byte[] getRaw() { | ||
return raw; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package redis.clients.jedis.util; | ||
|
||
import java.io.InputStream; | ||
import java.util.Properties; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Jedis Meta info load version groupId | ||
*/ | ||
public class JedisMetaInfo { | ||
private static final Logger log = LoggerFactory.getLogger(JedisMetaInfo.class); | ||
|
||
private static String groupId; | ||
private static String artifactId; | ||
private static String version; | ||
|
||
static { | ||
Properties p = new Properties(); | ||
try { | ||
InputStream in = JedisMetaInfo.class.getClassLoader().getResourceAsStream("pom.properties"); | ||
p.load(in); | ||
|
||
groupId = p.getProperty("groupId", null); | ||
artifactId = p.getProperty("artifactId", null); | ||
version = p.getProperty("version", null); | ||
|
||
in.close(); | ||
} catch (Exception e) { | ||
log.error("Load Jedis meta info from pom.properties failed", e); | ||
} | ||
} | ||
|
||
public static String getGroupId() { | ||
return groupId; | ||
} | ||
|
||
public static String getArtifactId() { | ||
return artifactId; | ||
} | ||
|
||
public static String getVersion() { | ||
return version; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
groupId=${project.groupId} | ||
artifactId=${project.artifactId} | ||
version=${project.version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters