Permalink
Browse files

Merge branch 'cassandra-3.5' into trunk

  • Loading branch information...
beobal committed Mar 24, 2016
2 parents 0a016ea + f6c5d72 commit 494386de8519e48c5f0d726ebef6b320cd86675a
View
@@ -23,6 +23,7 @@
3.5
* Fix clustering and row filters for LIKE queries on clustering columns (CASSANDRA-11397)
Merged from 3.0:
+ * Enable SO_REUSEADDR for JMX RMI server sockets (CASSANDRA-11093)
* Allocate merkletrees with the correct size (CASSANDRA-11390)
* Support streaming pre-3.0 sstables (CASSANDRA-10990)
* Add backpressure to compressed or encrypted commit log (CASSANDRA-10971)
@@ -1,16 +1,21 @@
package org.apache.cassandra.utils;
import java.io.IOException;
-import java.net.*;
+import java.net.InetAddress;
+import java.net.ServerSocket;
import java.rmi.server.RMIServerSocketFactory;
import javax.net.ServerSocketFactory;
public class RMIServerSocketFactoryImpl implements RMIServerSocketFactory
{
- public ServerSocket createServerSocket(final int pPort) throws IOException {
- return ServerSocketFactory.getDefault().createServerSocket(pPort, 0, InetAddress.getLoopbackAddress());
+ public ServerSocket createServerSocket(final int pPort) throws IOException
+ {
+ ServerSocket socket = ServerSocketFactory.getDefault()
+ .createServerSocket(pPort, 0, InetAddress.getLoopbackAddress());
+ socket.setReuseAddress(true);
+ return socket;
}
public boolean equals(Object obj)
@@ -0,0 +1,24 @@
+package org.apache.cassandra.service;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.rmi.server.RMIServerSocketFactory;
+
+import org.junit.Test;
+
+import org.apache.cassandra.utils.RMIServerSocketFactoryImpl;
+
+import static org.junit.Assert.assertTrue;
+
+
+public class RMIServerSocketFactoryImplTest
+{
+ @Test
+ public void testReusableAddrSocket() throws IOException
+ {
+ RMIServerSocketFactory serverFactory = new RMIServerSocketFactoryImpl();
+ ServerSocket socket = serverFactory.createServerSocket(7199);
+ assertTrue(socket.getReuseAddress());
+ }
+
+}

0 comments on commit 494386d

Please sign in to comment.