Skip to content
Permalink
Browse files
Merge pull request #11 from krummas/marcuse/15851
CASSANDRA-15851 - add instance initializer
  • Loading branch information
ifesdjeen committed Jun 10, 2020
2 parents f2dbed3 + c2feaad commit ad54e22d20c403d046374160050b8c25b24f4460
Showing 2 changed files with 14 additions and 1 deletion.
@@ -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>

@@ -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;
@@ -52,6 +53,7 @@
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)
{
@@ -94,6 +96,11 @@ public int getBroadcastPort() {
return broadcastPort;
}

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

public C start() throws IOException
{
C cluster = createWithoutStarting();
@@ -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;

0 comments on commit ad54e22

Please sign in to comment.