private void start() { scheduledExecutorService = Executors.newScheduledThreadPool(1); if( scheduledExecutorService != null){ Integer ddelay = 10; Integer dinternal = 30; try { CommonResult<SystemParameterDTO> params = systemParameterService.getByParamIDFromDB("gray.citylist.config"); String delay = ""; String internal = ""; if (params != null && params.getSuccess() && params.getContent() != null && params.getContent().getParamcontent() != null) { @SuppressWarnings("unchecked") Map<String,String> mapType = JSON.parseObject(params.getContent().getParamcontent(),Map.class); delay = mapType.get("sddelay"); internal = mapType.get("sdinternal"); } if(StringUtils.isNotBlank(delay)){ ddelay = Integer.valueOf(delay); } if(StringUtils.isNotBlank(internal)){ dinternal = Integer.valueOf(internal); } } catch (Exception e) { } Task task = new Task(); scheduledExecutorService.scheduleAtFixedRate(task, ddelay, dinternal, TimeUnit.MINUTES); } }