public void start ( ) { /** initial delay to execute schedule task, unit: ms */ long initialDelay = ConfigManager . conn_monitor_initial_delay ( ) ; /** period of schedule task, unit: ms*/ long period = ConfigManager . conn_monitor_period ( ) ; this . executor = new ScheduledThreadPoolExecutor ( 1 , new NamedThreadFactory ( "ConnectionMonitorThread" , true ) , new ThreadPoolExecutor . AbortPolicy ( ) ) ; MonitorTask monitorTask = new MonitorTask ( ) ; this . executor . scheduleAtFixedRate ( monitorTask , initialDelay , period , TimeUnit . MILLISECONDS ) ; }
Start schedule task