Source:
public SchedulerImpl(RxSession session) { this.session = session; jobFactories = new HashMap<>(); tickExecutor = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setNameFormat("ticker-pool-%d").build()); queueExecutor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat("job-queue-pool-%d").build()); tickScheduler = Schedulers.from(tickExecutor); queueScheduler = Schedulers.from(queueExecutor); queryExecutor = Executors.newFixedThreadPool(4, new ThreadFactoryBuilder().setNameFormat("query-thread-pool-%d").build()); queryScheduler = Schedulers.from(queryExecutor); lockManager = new LockManager(session); insertJob = session.getSession().prepare( "INSERT INTO jobs (id, type, name, params, trigger) VALUES (?, ?, ?, ?, ?)"); insertScheduledJob = session.getSession().prepare( "INSERT INTO scheduled_jobs_idx (time_slice, job_id) VALUES (?, ?)"); findScheduledJobs = session.getSession().prepare( "SELECT job_id FROM scheduled_jobs_idx WHERE time_slice = ?"); deleteScheduledJobs = session.getSession().prepare( "DELETE FROM scheduled_jobs_idx WHERE time_slice = ?"); findFinishedJobs = session.getSession().prepare( "SELECT job_id FROM finished_jobs_idx WHERE time_slice = ?"); deleteFinishedJobs = session.getSession().prepare( "DELETE FROM finished_jobs_idx WHERE time_slice = ?"); updateJobToFinished = session.getSession().prepare( "INSERT INTO finished_jobs_idx (time_slice, job_id) VALUES (?, ?)"); findJob = session.getSession().prepare("SELECT type, name, params, trigger FROM jobs WHERE id = ?"); addActiveTimeSlice = session.getSession().prepare("INSERT INTO active_time_slices (time_slice) VALUES (?)"); findActiveTimeSlices = session.getSession().prepare("SELECT DISTINCT time_slice FROM active_time_slices"); deleteActiveTimeSlice = session.getSession().prepare("DELETE FROM active_time_slices WHERE time_slice = ?"); finishedTimeSlices = Optional.empty(); jobFinished = Optional.empty(); }

Target:
public SchedulerImpl(RxSession session) { this.session = session; jobFactories = new HashMap<>(); tickExecutor = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setNameFormat("ticker-pool-%d").build()); tickScheduler = Schedulers.from(tickExecutor); ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("query-thread-pool-%d").build(); queryExecutor = new ThreadPoolExecutor(4, 4, 0, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), threadFactory, new ThreadPoolExecutor.DiscardPolicy()); queryScheduler = Schedulers.from(queryExecutor); lockManager = new LockManager(session); insertJob = session.getSession().prepare( "INSERT INTO jobs (id, type, name, params, trigger) VALUES (?, ?, ?, ?, ?)"); insertScheduledJob = session.getSession().prepare( "INSERT INTO scheduled_jobs_idx (time_slice, job_id) VALUES (?, ?)"); findScheduledJobs = session.getSession().prepare( "SELECT job_id FROM scheduled_jobs_idx WHERE time_slice = ?"); deleteScheduledJobs = session.getSession().prepare( "DELETE FROM scheduled_jobs_idx WHERE time_slice = ?"); findFinishedJobs = session.getSession().prepare( "SELECT job_id FROM finished_jobs_idx WHERE time_slice = ?"); deleteFinishedJobs = session.getSession().prepare( "DELETE FROM finished_jobs_idx WHERE time_slice = ?"); updateJobToFinished = session.getSession().prepare( "INSERT INTO finished_jobs_idx (time_slice, job_id) VALUES (?, ?)"); findJob = session.getSession().prepare("SELECT type, name, params, trigger FROM jobs WHERE id = ?"); addActiveTimeSlice = session.getSession().prepare("INSERT INTO active_time_slices (time_slice) VALUES (?)"); findActiveTimeSlices = session.getSession().prepare("SELECT DISTINCT time_slice FROM active_time_slices"); deleteActiveTimeSlice = session.getSession().prepare("DELETE FROM active_time_slices WHERE time_slice = ?"); finishedTimeSlices = Optional.empty(); jobFinished = Optional.empty(); }