java-延时执行-参数-任务

luvhl 2019-12-09

定义任务

ScheduledExecutorService scheduledExecutorService =
Executors.newScheduledThreadPool(50);
scheduledExecutorService.schedule(new DoorGuardDelUserThreadPool(vd,companyDao,preRegistrationDataDao,doorGuardService,c.getDomain()), 10*60, TimeUnit.SECONDS);

写执行内容:实现 Runnable接口

private ICompanyDao companyDao;

private IPreRegistrationDataDao preRegistrationDataDao;

private IDoorGuardService doorGuardService;

private String domain;

public DoorGuardDelUserThreadPool(VisitorData vd, ICompanyDao companyDao, IPreRegistrationDataDao preRegistrationDataDao, IDoorGuardService doorGuardService,String domain) {
this.finalVd = vd;
this.companyDao = companyDao;
this.preRegistrationDataDao = preRegistrationDataDao;
this.doorGuardService = doorGuardService;
this.domain = domain;
}

@Override
public void run() {
log.info("companyDao:"+companyDao);
log.info("finalVd.getCompany_id():"+finalVd.getCompany_id());
log.info("finalVd.getPre_registration_id() :"+finalVd.getPre_registration_id() );
log.info("domain :"+domain );

}

相关推荐