Skip to content

Commit cdc7c79

Browse files
committed
Some changes to reset() function in builder
1 parent 0b8e372 commit cdc7c79

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.github.codemonstur</groupId>
55
<artifactId>embedded-redis</artifactId>
6-
<version>1.4.1</version>
6+
<version>1.4.2</version>
77
<packaging>jar</packaging>
88

99
<name>embedded-redis</name>

src/main/java/redis/embedded/core/RedisSentinelBuilder.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public final class RedisSentinelBuilder {
2525
LINE_PORT = "port %d";
2626

2727
private File executable;
28+
2829
private ExecutableProvider executableProvider = newJarResourceProvider();
2930
private String bind = "127.0.0.1";
3031
private Integer port = 26379;
@@ -100,13 +101,8 @@ public RedisSentinelBuilder settingIf(final boolean shouldSet, final String conf
100101
}
101102

102103
public RedisSentinelBuilder setting(final String configLine) {
103-
if (sentinelConf != null) {
104-
throw new IllegalArgumentException("Redis configuration is already set using redis conf file");
105-
}
106-
107-
if (redisConfigBuilder == null) {
108-
redisConfigBuilder = new StringBuilder();
109-
}
104+
if (sentinelConf != null) throw new IllegalArgumentException("Redis configuration is already set using redis conf file");
105+
if (redisConfigBuilder == null) redisConfigBuilder = new StringBuilder();
110106

111107
redisConfigBuilder.append(configLine).append(LINE_SEPARATOR);
112108
return this;

src/main/java/redis/embedded/core/RedisServerBuilder.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public final class RedisServerBuilder {
2121

2222
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
2323

24-
private File executable;
2524
private ExecutableProvider provider = newJarResourceProvider();
2625
private String bindAddress = "127.0.0.1";
2726
private int bindPort = DEFAULT_REDIS_PORT;
@@ -94,14 +93,7 @@ public RedisServer build() throws IOException {
9493
}
9594

9695
public void reset() {
97-
this.executable = null;
9896
this.slaveOf = null;
99-
this.redisConfigBuilder = new StringBuilder();
100-
this.provider = newJarResourceProvider();
101-
this.bindAddress = "127.0.0.1";
102-
this.bindPort = DEFAULT_REDIS_PORT;
103-
this.soutListener = null;
104-
this.serrListener = null;
10597
}
10698

10799
public List<String> buildCommandArgs() throws IOException {
@@ -110,10 +102,8 @@ public List<String> buildCommandArgs() throws IOException {
110102
final Path redisConfigFile =
111103
writeNewRedisConfigFile("embedded-redis-server_" + bindPort, redisConfigBuilder.toString());
112104

113-
executable = provider.get();
114-
115105
final List<String> args = new ArrayList<>();
116-
args.add(executable.getAbsolutePath());
106+
args.add(provider.get().getAbsolutePath());
117107
args.add(redisConfigFile.toAbsolutePath().toString());
118108
args.add("--port");
119109
args.add(Integer.toString(bindPort));

0 commit comments

Comments
 (0)