apurtell commented on code in PR #4644:
URL: https://github.com/apache/hbase/pull/4644#discussion_r929384756
##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientIdGenerator.java:
##########
@@ -61,10 +64,10 @@ public static byte[] generateClientId() {
/** Returns PID of the current process, if it can be extracted from JVM
name, or null. */
public static Long getPid() {
String name = ManagementFactory.getRuntimeMXBean().getName();
- String[] nameParts = name.split("@");
- if (nameParts.length == 2) { // 12345@somewhere
+ List<String> nameParts = Splitter.on('@').splitToList(name);
+ if (nameParts.size() == 2) { // 12345@somewhere
try {
- return Long.parseLong(nameParts[0]);
+ return Long.parseLong(nameParts.iterator().next()); // first element
Review Comment:
@Apache9 Will use Iterators.get() here too.
##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClientIdGenerator.java:
##########
@@ -61,10 +64,10 @@ public static byte[] generateClientId() {
/** Returns PID of the current process, if it can be extracted from JVM
name, or null. */
public static Long getPid() {
String name = ManagementFactory.getRuntimeMXBean().getName();
- String[] nameParts = name.split("@");
- if (nameParts.length == 2) { // 12345@somewhere
+ List<String> nameParts = Splitter.on('@').splitToList(name);
+ if (nameParts.size() == 2) { // 12345@somewhere
try {
- return Long.parseLong(nameParts[0]);
+ return Long.parseLong(nameParts.iterator().next()); // first element
Review Comment:
@Apache9 Will use Iterators.get() here too etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]