diff --git a/.build/build-resolver.xml b/.build/build-resolver.xml
index 29031b33a115..39bb6743f7a3 100644
--- a/.build/build-resolver.xml
+++ b/.build/build-resolver.xml
@@ -70,7 +70,8 @@
or ~/.ant/settings.xml (maven ant resolver supersedes) as mirrors will, by default, catch and override
all dependency resolution regardless of it being a -SNAPSHOT lib or not.
-->
-
+
+
diff --git a/.build/parent-maven-pom.xml b/.build/parent-maven-pom.xml
index e61e4208d67e..ee00ae3cc8b7 100644
--- a/.build/parent-maven-pom.xml
+++ b/.build/parent-maven-pom.xml
@@ -524,7 +524,7 @@
org.apache.cassandra
dtest-api
- 0.0.17
+ 0.0.18-cd80924-SNAPSHOT
test
diff --git a/src/java/org/apache/cassandra/utils/RMIClientSocketFactoryImpl.java b/src/java/org/apache/cassandra/utils/RMIClientSocketFactoryImpl.java
deleted file mode 100644
index 9be9e69f0409..000000000000
--- a/src/java/org/apache/cassandra/utils/RMIClientSocketFactoryImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cassandra.utils;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * This class is used to override the local address the JMX client calculates when trying to connect,
- * which can otherwise be influenced by the system property "java.rmi.server.hostname" in strange and
- * unpredictable ways.
- */
-public class RMIClientSocketFactoryImpl implements Serializable, RMICloseableClientSocketFactory
-{
- private static final long serialVersionUID = 955153017775496366L;
- List sockets = new ArrayList<>();
- private final InetAddress localAddress;
-
- public RMIClientSocketFactoryImpl(InetAddress localAddress)
- {
- this.localAddress = localAddress;
- }
-
- @Override
- public Socket createSocket(String host, int port) throws IOException
- {
- Socket socket = new Socket(localAddress, port);
- sockets.add(socket);
- return socket;
- }
-
- @Override
- public void close() throws IOException
- {
- for (Socket socket: sockets)
- {
- try
- {
- socket.close();
- }
- catch (IOException ignored)
- {
- // intentionally ignored
- }
- }
- }
-
- @Override
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- RMIClientSocketFactoryImpl that = (RMIClientSocketFactoryImpl) o;
- return Objects.equals(localAddress, that.localAddress);
- }
-
- @Override
- public int hashCode()
- {
- return Objects.hash(localAddress);
- }
-}
diff --git a/src/java/org/apache/cassandra/utils/RMICloseableClientSocketFactory.java b/src/java/org/apache/cassandra/utils/RMICloseableClientSocketFactory.java
deleted file mode 100644
index 1e2225772abe..000000000000
--- a/src/java/org/apache/cassandra/utils/RMICloseableClientSocketFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cassandra.utils;
-
-import java.rmi.server.RMIClientSocketFactory;
-
-/**
- * This represents closeable RMI Client Socket factory. It extends {@link AutoCloseable} and can be used with
- * {@code try-with-resources}.
- */
-public interface RMICloseableClientSocketFactory extends RMIClientSocketFactory, AutoCloseable
-{
-}
diff --git a/src/java/org/apache/cassandra/utils/RMICloseableServerSocketFactory.java b/src/java/org/apache/cassandra/utils/RMICloseableServerSocketFactory.java
deleted file mode 100644
index b9d70f083ae5..000000000000
--- a/src/java/org/apache/cassandra/utils/RMICloseableServerSocketFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cassandra.utils;
-
-import java.rmi.server.RMIServerSocketFactory;
-
-/**
- * This represents closeable RMI Server Socket factory. It extends {@link AutoCloseable} and can be used with
- * {@code try-with-resources}.
- */
-public interface RMICloseableServerSocketFactory extends RMIServerSocketFactory, AutoCloseable
-{
-}
diff --git a/test/distributed/org/apache/cassandra/distributed/impl/AbstractCluster.java b/test/distributed/org/apache/cassandra/distributed/impl/AbstractCluster.java
index 805d15665a5c..224adabdb100 100644
--- a/test/distributed/org/apache/cassandra/distributed/impl/AbstractCluster.java
+++ b/test/distributed/org/apache/cassandra/distributed/impl/AbstractCluster.java
@@ -228,12 +228,6 @@ public AbstractBuilder(Factory factory)
withSharedClasses(SHARED_PREDICATE);
}
- @SuppressWarnings("unchecked")
- private B self()
- {
- return (B) this;
- }
-
public B withNodeProvisionStrategy(INodeProvisionStrategy.Factory nodeProvisionStrategy)
{
this.nodeProvisionStrategy = nodeProvisionStrategy;
@@ -618,7 +612,7 @@ public InstanceConfig newInstanceConfig()
}
@VisibleForTesting
- InstanceConfig createInstanceConfig(int nodeNum)
+ public InstanceConfig createInstanceConfig(int nodeNum)
{
INodeProvisionStrategy provisionStrategy = nodeProvisionStrategy.create(subnet, portMap);
Collection tokens = tokenSupplier.tokens(nodeNum);
diff --git a/test/distributed/org/apache/cassandra/distributed/impl/CollectingRMIServerSocketFactoryImpl.java b/test/distributed/org/apache/cassandra/distributed/impl/CollectingRMIServerSocketFactoryImpl.java
deleted file mode 100644
index bba536f67f4e..000000000000
--- a/test/distributed/org/apache/cassandra/distributed/impl/CollectingRMIServerSocketFactoryImpl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cassandra.distributed.impl;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.SocketException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import javax.net.ServerSocketFactory;
-
-import org.apache.cassandra.utils.RMICloseableServerSocketFactory;
-
-
-/**
- * This class is used to keep track of RMI servers created during a cluster creation so we can
- * later close the sockets, which would otherwise be left with a thread running waiting for
- * connections that would never show up as the server was otherwise closed.
- */
-class CollectingRMIServerSocketFactoryImpl implements RMICloseableServerSocketFactory
-{
- private final InetAddress bindAddress;
- List sockets = new ArrayList<>();
-
- public CollectingRMIServerSocketFactoryImpl(InetAddress bindAddress)
- {
- this.bindAddress = bindAddress;
- }
-
- @Override
- public ServerSocket createServerSocket(int pPort) throws IOException
- {
- ServerSocket result = ServerSocketFactory.getDefault().createServerSocket(pPort, 0, bindAddress);
- try
- {
- result.setReuseAddress(true);
- }
- catch (SocketException e)
- {
- result.close();
- throw e;
- }
- sockets.add(result);
- return result;
- }
-
- @Override
- public void close() throws IOException
- {
- for (ServerSocket socket : sockets)
- {
- socket.close();
- }
- }
-
- @Override
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- CollectingRMIServerSocketFactoryImpl that = (CollectingRMIServerSocketFactoryImpl) o;
- return Objects.equals(bindAddress, that.bindAddress);
- }
-
- @Override
- public int hashCode()
- {
- return Objects.hash(bindAddress);
- }
-}
diff --git a/test/distributed/org/apache/cassandra/distributed/impl/CollectingSslRMIServerSocketFactoryImpl.java b/test/distributed/org/apache/cassandra/distributed/impl/CollectingSslRMIServerSocketFactoryImpl.java
deleted file mode 100644
index 0d13aa6290cc..000000000000
--- a/test/distributed/org/apache/cassandra/distributed/impl/CollectingSslRMIServerSocketFactoryImpl.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cassandra.distributed.impl;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-
-import org.apache.cassandra.utils.RMICloseableServerSocketFactory;
-
-
-/**
- * This class is used to keep track of SSL based RMI servers created during a cluster creation to
- * later close the sockets, which would otherwise be left with a thread running waiting for
- * connections that would never show up as the server was otherwise closed.
- */
-class CollectingSslRMIServerSocketFactoryImpl implements RMICloseableServerSocketFactory
-{
- private final InetAddress bindAddress;
- private final String[] enabledCipherSuites;
- private final String[] enabledProtocols;
- private final boolean needClientAuth;
- private final SSLSocketFactory sslSocketFactory;
- List sockets = new ArrayList<>();
-
- public CollectingSslRMIServerSocketFactoryImpl(InetAddress bindAddress, String[] enabledCipherSuites,
- String[] enabledProtocols, boolean needClientAuth, SSLContext sslContext)
- {
- this.bindAddress = bindAddress;
- this.enabledCipherSuites = enabledCipherSuites;
- this.enabledProtocols = enabledProtocols;
- this.needClientAuth = needClientAuth;
- this.sslSocketFactory = sslContext.getSocketFactory();
- }
-
- public String[] getEnabledCipherSuites()
- {
- return enabledCipherSuites;
- }
-
- public String[] getEnabledProtocols()
- {
- return enabledProtocols;
- }
-
- public boolean isNeedClientAuth()
- {
- return needClientAuth;
- }
-
- @Override
- public ServerSocket createServerSocket(int pPort) throws IOException
- {
- ServerSocket result = createSslServerSocket(pPort);
- try
- {
- result.setReuseAddress(true);
- }
- catch (SocketException e)
- {
- result.close();
- throw e;
- }
- sockets.add(result);
- return result;
- }
-
- private ServerSocket createSslServerSocket(int pPort) throws IOException
- {
- return new ServerSocket(pPort, 0, bindAddress)
- {
- public Socket accept() throws IOException
- {
- Socket socket = super.accept();
- SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(
- socket, socket.getInetAddress().getHostName(),
- socket.getPort(), true);
- sslSocket.setUseClientMode(false);
- if (enabledCipherSuites != null)
- {
- sslSocket.setEnabledCipherSuites(enabledCipherSuites);
- }
- if (enabledProtocols != null)
- {
- sslSocket.setEnabledProtocols(enabledProtocols);
- }
- sslSocket.setNeedClientAuth(needClientAuth);
- return sslSocket;
- }
- };
- }
-
- @Override
- public void close() throws IOException
- {
- for (ServerSocket socket : sockets)
- {
- socket.close();
- }
- }
-
- @Override
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- CollectingSslRMIServerSocketFactoryImpl that = (CollectingSslRMIServerSocketFactoryImpl) o;
- return Objects.equals(bindAddress, that.bindAddress);
- }
-
- @Override
- public int hashCode()
- {
- return Objects.hash(bindAddress);
- }
-
- private static SSLSocketFactory defaultSSLSocketFactory = null;
-
- private static synchronized SSLSocketFactory getDefaultSSLSocketFactory()
- {
- if (defaultSSLSocketFactory == null)
- defaultSSLSocketFactory =
- (SSLSocketFactory) SSLSocketFactory.getDefault();
- return defaultSSLSocketFactory;
- }
-}
diff --git a/test/distributed/org/apache/cassandra/distributed/impl/IsolatedJmx.java b/test/distributed/org/apache/cassandra/distributed/impl/IsolatedJmx.java
index 7ad57a52b6b4..554b7a7317bc 100644
--- a/test/distributed/org/apache/cassandra/distributed/impl/IsolatedJmx.java
+++ b/test/distributed/org/apache/cassandra/distributed/impl/IsolatedJmx.java
@@ -33,17 +33,18 @@
import javax.management.remote.rmi.RMIJRMPServerImpl;
import com.google.common.util.concurrent.Uninterruptibles;
+
import org.slf4j.Logger;
import org.apache.cassandra.config.EncryptionOptions;
import org.apache.cassandra.config.JMXServerOptions;
import org.apache.cassandra.distributed.api.IInstance;
import org.apache.cassandra.distributed.api.IInstanceConfig;
+import org.apache.cassandra.distributed.shared.jmx.RMICloseableClientSocketFactory;
+import org.apache.cassandra.distributed.shared.jmx.RMICloseableServerSocketFactory;
import org.apache.cassandra.distributed.shared.JMXUtil;
import org.apache.cassandra.utils.JMXServerUtils;
import org.apache.cassandra.utils.MBeanWrapper;
-import org.apache.cassandra.utils.RMICloseableClientSocketFactory;
-import org.apache.cassandra.utils.RMICloseableServerSocketFactory;
import sun.rmi.transport.tcp.TCPEndpoint;
import static org.apache.cassandra.config.CassandraRelevantProperties.JAVA_RMI_DGC_LEASE_VALUE_IN_JVM_DTEST;
diff --git a/test/distributed/org/apache/cassandra/distributed/impl/IsolatedJmxSocketFactory.java b/test/distributed/org/apache/cassandra/distributed/impl/IsolatedJmxSocketFactory.java
index 2aa4415af929..108ca9f1bcd0 100644
--- a/test/distributed/org/apache/cassandra/distributed/impl/IsolatedJmxSocketFactory.java
+++ b/test/distributed/org/apache/cassandra/distributed/impl/IsolatedJmxSocketFactory.java
@@ -27,7 +27,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.cassandra.utils.RMIClientSocketFactoryImpl;
+import org.apache.cassandra.distributed.shared.jmx.CollectingRMIServerSocketFactoryImpl;
+import org.apache.cassandra.distributed.shared.jmx.CollectingSslRMIServerSocketFactoryImpl;
+import org.apache.cassandra.distributed.shared.jmx.RMIClientSocketFactoryImpl;
+import org.apache.cassandra.distributed.shared.jmx.RMISslClientSocketFactoryImpl;
import org.apache.cassandra.utils.jmx.AbstractJmxSocketFactory;
import static javax.management.remote.rmi.RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE;
diff --git a/test/distributed/org/apache/cassandra/distributed/impl/RMISslClientSocketFactoryImpl.java b/test/distributed/org/apache/cassandra/distributed/impl/RMISslClientSocketFactoryImpl.java
deleted file mode 100644
index bca6b1fb6aad..000000000000
--- a/test/distributed/org/apache/cassandra/distributed/impl/RMISslClientSocketFactoryImpl.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cassandra.distributed.impl;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.regex.Pattern;
-import javax.net.SocketFactory;
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-
-import org.apache.cassandra.utils.RMICloseableClientSocketFactory;
-
-/**
- * {@code RMIClientSocketFactory} for testing SSL based JMX clients.
- * This class is used to override the local address the JMX client calculates when trying to connect,
- * which can otherwise be influenced by the system property "java.rmi.server.hostname" in strange and
- * unpredictable ways.
- */
-public class RMISslClientSocketFactoryImpl implements Serializable, RMICloseableClientSocketFactory
-{
- private static final long serialVersionUID = 9054380061905145241L;
- private static final Pattern COMMA_SPLITTER = Pattern.compile(",");
- private static final List sockets = new ArrayList<>();
- private final InetAddress localAddress;
- private final String[] enabledCipherSuites;
- private final String[] enabledProtocols;
-
- public RMISslClientSocketFactoryImpl(InetAddress localAddress, String enabledCipherSuites, String enabledProtocls)
- {
- this.localAddress = localAddress;
- this.enabledCipherSuites = splitCommaSeparatedString(enabledCipherSuites);
- this.enabledProtocols = splitCommaSeparatedString(enabledProtocls);
- }
-
- @Override
- public Socket createSocket(String host, int port) throws IOException
- {
- Socket socket = createSslSocket(port);
- sockets.add(socket);
- return socket;
- }
-
- private Socket createSslSocket(int port) throws IOException
- {
- final SocketFactory sslSocketFactory = SSLSocketFactory.getDefault();
- final SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(localAddress, port);
- if (enabledCipherSuites != null)
- {
- try
- {
- sslSocket.setEnabledCipherSuites(enabledCipherSuites);
- }
- catch (IllegalArgumentException e)
- {
- throw new IOException(e.getMessage(), e);
- }
- }
- if (enabledProtocols != null)
- {
- try
- {
- sslSocket.setEnabledProtocols(enabledProtocols);
- }
- catch (IllegalArgumentException e)
- {
- throw new IOException(e.getMessage(), e);
- }
- }
- return sslSocket;
- }
-
- @Override
- public void close() throws IOException
- {
- for (Socket socket : sockets)
- {
- try
- {
- socket.close();
- }
- catch (IOException ignored)
- {
- // intentionally ignored
- }
- }
- }
-
- @Override
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- RMISslClientSocketFactoryImpl that = (RMISslClientSocketFactoryImpl) o;
- return Objects.equals(localAddress, that.localAddress);
- }
-
- @Override
- public int hashCode()
- {
- return Objects.hash(localAddress);
- }
-
- private String[] splitCommaSeparatedString(String stringToSplit)
- {
- if (stringToSplit == null)
- return null;
- return COMMA_SPLITTER.split(stringToSplit);
- }
-}