-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
read-threads
option caused class cast exception
- Loading branch information
Showing
13 changed files
with
81 additions
and
22 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
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
32 changes: 32 additions & 0 deletions
32
plugins/riot/src/main/java/com/redis/riot/RangeConverter.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,32 @@ | ||
package com.redis.riot; | ||
|
||
import org.springframework.util.StringUtils; | ||
|
||
import com.redis.spring.batch.item.redis.common.Range; | ||
|
||
import picocli.CommandLine.ITypeConverter; | ||
|
||
public class RangeConverter implements ITypeConverter<Range> { | ||
|
||
public static final String SEPARATOR = "-"; | ||
|
||
@Override | ||
public Range convert(String value) { | ||
int pos = value.indexOf(SEPARATOR); | ||
if (pos == -1) { | ||
int intValue = Integer.parseInt(value); | ||
return new Range(intValue, intValue); | ||
} | ||
int min = Integer.parseInt(value.substring(0, pos).trim()); | ||
int max = max(value.substring(pos + 1).trim()); | ||
return new Range(min, max); | ||
} | ||
|
||
private static int max(String value) { | ||
if (StringUtils.hasLength(value)) { | ||
return Integer.parseInt(value); | ||
} | ||
return Integer.MAX_VALUE; | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
plugins/riot/src/main/java/com/redis/riot/RedisURIConverter.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,17 @@ | ||
package com.redis.riot; | ||
|
||
import io.lettuce.core.RedisURI; | ||
import picocli.CommandLine.ITypeConverter; | ||
|
||
public class RedisURIConverter implements ITypeConverter<RedisURI> { | ||
|
||
@Override | ||
public RedisURI convert(String value) { | ||
try { | ||
return RedisURI.create(value); | ||
} catch (IllegalArgumentException e) { | ||
return RedisURI.create(RedisURI.URI_SCHEME_REDIS + "://" + value); | ||
} | ||
} | ||
|
||
} |
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