Skip to content

Commit

Permalink
CASSANDRA-15851 - add instance initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
krummas committed Jun 10, 2020
1 parent f2dbed3 commit c2feaad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cassandra</groupId>
<artifactId>dtest-api</artifactId>
<version>0.0.2-SNAPSHOT</version>
<version>0.0.3-SNAPSHOT</version>
<name>In JVM Test API</name>
<description>In JVM Test API</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand All @@ -52,6 +53,7 @@ public interface Factory<I extends IInstance, C extends ICluster, B extends Abst
private Consumer<IInstanceConfig> configUpdater;
private ClassLoader sharedClassLoader = Thread.currentThread().getContextClassLoader();
private int broadcastPort = 7012;
private BiConsumer<ClassLoader, Integer> instanceInitializer = (cl, id) -> {};

public AbstractBuilder(Factory<I, C, B> factory)
{
Expand Down Expand Up @@ -94,6 +96,11 @@ public int getBroadcastPort() {
return broadcastPort;
}

public BiConsumer<ClassLoader, Integer> getInstanceInitializer()
{
return instanceInitializer;
}

public C start() throws IOException
{
C cluster = createWithoutStarting();
Expand Down Expand Up @@ -255,6 +262,12 @@ public B withConfig(Consumer<IInstanceConfig> updater)
return (B) this;
}

public B withInstanceInitializer(BiConsumer<ClassLoader, Integer> instanceInitializer)
{
this.instanceInitializer = instanceInitializer;
return (B) this;
}

static String dcName(int index)
{
return "datacenter" + index;
Expand Down

0 comments on commit c2feaad

Please sign in to comment.