Source:
public DefaultNettyOptions(InternalDriverContext context) { DriverExecutionProfile config = context.getConfig().getDefaultProfile(); int ioGroupSize = config.getInt(DefaultDriverOption.NETTY_IO_SIZE); this.ioShutdownQuietPeriod = config.getInt(DefaultDriverOption.NETTY_IO_SHUTDOWN_QUIET_PERIOD); this.ioShutdownTimeout = config.getInt(DefaultDriverOption.NETTY_IO_SHUTDOWN_TIMEOUT); this.ioShutdownUnit = TimeUnit.valueOf(config.getString(DefaultDriverOption.NETTY_IO_SHUTDOWN_UNIT)); int adminGroupSize = config.getInt(DefaultDriverOption.NETTY_ADMIN_SIZE); this.adminShutdownQuietPeriod = config.getInt(DefaultDriverOption.NETTY_ADMIN_SHUTDOWN_QUIET_PERIOD); this.adminShutdownTimeout = config.getInt(DefaultDriverOption.NETTY_ADMIN_SHUTDOWN_TIMEOUT); this.adminShutdownUnit = TimeUnit.valueOf(config.getString(DefaultDriverOption.NETTY_ADMIN_SHUTDOWN_UNIT)); ThreadFactory safeFactory = new BlockingOperation.SafeThreadFactory(); ThreadFactory ioThreadFactory = new ThreadFactoryBuilder() .setThreadFactory(safeFactory) .setNameFormat(context.getSessionName() + "-io-%d") .build(); this.ioEventLoopGroup = new NioEventLoopGroup(ioGroupSize, ioThreadFactory); ThreadFactory adminThreadFactory = new ThreadFactoryBuilder() .setThreadFactory(safeFactory) .setNameFormat(context.getSessionName() + "-admin-%d") .build(); this.adminEventLoopGroup = new DefaultEventLoopGroup(adminGroupSize, adminThreadFactory); ThreadFactory timerThreadFactory = new ThreadFactoryBuilder().setThreadFactory(safeFactory).build(); timer = new HashedWheelTimer( timerThreadFactory, config.getDuration(DefaultDriverOption.NETTY_TIMER_TICK_DURATION).toNanos(), TimeUnit.NANOSECONDS, config.getInt(DefaultDriverOption.NETTY_TIMER_TICKS_PER_WHEEL)); Runtime.getRuntime() .addShutdownHook( new Thread() { @Override public void run() { timer.stop(); } }); }

Target:
public DefaultNettyOptions(InternalDriverContext context) { DriverExecutionProfile config = context.getConfig().getDefaultProfile(); int ioGroupSize = config.getInt(DefaultDriverOption.NETTY_IO_SIZE); this.ioShutdownQuietPeriod = config.getInt(DefaultDriverOption.NETTY_IO_SHUTDOWN_QUIET_PERIOD); this.ioShutdownTimeout = config.getInt(DefaultDriverOption.NETTY_IO_SHUTDOWN_TIMEOUT); this.ioShutdownUnit = TimeUnit.valueOf(config.getString(DefaultDriverOption.NETTY_IO_SHUTDOWN_UNIT)); int adminGroupSize = config.getInt(DefaultDriverOption.NETTY_ADMIN_SIZE); this.adminShutdownQuietPeriod = config.getInt(DefaultDriverOption.NETTY_ADMIN_SHUTDOWN_QUIET_PERIOD); this.adminShutdownTimeout = config.getInt(DefaultDriverOption.NETTY_ADMIN_SHUTDOWN_TIMEOUT); this.adminShutdownUnit = TimeUnit.valueOf(config.getString(DefaultDriverOption.NETTY_ADMIN_SHUTDOWN_UNIT)); ThreadFactory safeFactory = new BlockingOperation.SafeThreadFactory(); ThreadFactory ioThreadFactory = new ThreadFactoryBuilder() .setThreadFactory(safeFactory) .setNameFormat(context.getSessionName() + "-io-%d") .build(); this.ioEventLoopGroup = new NioEventLoopGroup(ioGroupSize, ioThreadFactory); ThreadFactory adminThreadFactory = new ThreadFactoryBuilder() .setThreadFactory(safeFactory) .setNameFormat(context.getSessionName() + "-admin-%d") .build(); this.adminEventLoopGroup = new DefaultEventLoopGroup(adminGroupSize, adminThreadFactory); ThreadFactory timerThreadFactory = new ThreadFactoryBuilder() .setThreadFactory(safeFactory) .setNameFormat(context.getSessionName() + "-timer-%d") .build(); timer = new HashedWheelTimer( timerThreadFactory, config.getDuration(DefaultDriverOption.NETTY_TIMER_TICK_DURATION).toNanos(), TimeUnit.NANOSECONDS, config.getInt(DefaultDriverOption.NETTY_TIMER_TICKS_PER_WHEEL)); }