File tree Expand file tree Collapse file tree
driver-core/src/main/java/com/datastax/driver/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77- [ bug] JAVA-1258: Regression: Mapper cannot map a materialized view after JAVA-1126.
88- [ bug] JAVA-1101: Batch and BatchStatement should consider inner statements to determine query idempotence
99- [ improvement] JAVA-1262: Use ParseUtils for quoting & unquoting.
10+ - [ improvement] JAVA-1275: Use Netty's default thread factory
1011
1112
1213### 3.0.3
Original file line number Diff line number Diff line change 2525import com .google .common .base .Throwables ;
2626import com .google .common .collect .*;
2727import com .google .common .util .concurrent .*;
28+ import io .netty .util .concurrent .DefaultThreadFactory ;
2829import org .slf4j .Logger ;
2930import org .slf4j .LoggerFactory ;
3031
@@ -1515,7 +1516,14 @@ ProtocolVersion protocolVersion() {
15151516 }
15161517
15171518 ThreadFactory threadFactory (String name ) {
1518- return new ThreadFactoryBuilder ().setNameFormat (clusterName + "-" + name + "-%d" ).build ();
1519+ return new ThreadFactoryBuilder ()
1520+ .setNameFormat (clusterName + "-" + name + "-%d" )
1521+ // Back with Netty's thread factory in order to create FastThreadLocalThread instances. This allows
1522+ // an optimization around ThreadLocals (we could use DefaultThreadFactory directly but it creates
1523+ // slightly different thread names, so keep we keep a ThreadFactoryBuilder wrapper for backward
1524+ // compatibility).
1525+ .setThreadFactory (new DefaultThreadFactory ("ignored name" ))
1526+ .build ();
15191527 }
15201528
15211529 private ListeningExecutorService makeExecutor (int threads , String name , LinkedBlockingQueue <Runnable > workQueue ) {
Original file line number Diff line number Diff line change @@ -89,7 +89,10 @@ public class NettyOptions {
8989 *
9090 * @param threadFactory The {@link ThreadFactory} to use when creating a new {@code EventLoopGroup} instance;
9191 * The driver will provide its own internal thread factory here.
92- * It is safe to ignore it and use another thread factory.
92+ * It is safe to ignore it and use another thread factory. Note however that for optimal
93+ * performance it is recommended to use a factory that returns
94+ * {@link io.netty.util.concurrent.FastThreadLocalThread} instances (such as Netty's
95+ * {@link java.util.concurrent.Executors.DefaultThreadFactory}).
9396 * @return the {@code EventLoopGroup} instance to use.
9497 */
9598 public EventLoopGroup eventLoopGroup (ThreadFactory threadFactory ) {
@@ -205,7 +208,10 @@ public void onClusterClose(EventLoopGroup eventLoopGroup) {
205208 *
206209 * @param threadFactory The {@link ThreadFactory} to use when creating a new {@link HashedWheelTimer} instance;
207210 * The driver will provide its own internal thread factory here.
208- * It is safe to ignore it and use another thread factory.
211+ * It is safe to ignore it and use another thread factory. Note however that for optimal
212+ * performance it is recommended to use a factory that returns
213+ * {@link io.netty.util.concurrent.FastThreadLocalThread} instances (such as Netty's
214+ * {@link java.util.concurrent.Executors.DefaultThreadFactory}).
209215 * @return the {@link Timer} instance to use.
210216 */
211217 public Timer timer (ThreadFactory threadFactory ) {
You can’t perform that action at this time.
0 commit comments