ThreadPoolExecutor pool= new ThreadPoolExecutor(5,10, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
IbcServiceConstants ibcServiceConstants=CfwConstants.ctx.getBean(IbcServiceConstants.class);
String userPath=ibcServiceConstants.getUserLoginLogDir()+statDate.substring(0, 4)+"/"+statDate.substring(4, 6)+"/"+statDate;
String accountPath=ibcServiceConstants.getAccountLoginLogDir()+statDate.substring(0, 4)+"/"+statDate.substring(4, 6)+"/"+statDate;
String memberPath=ibcServiceConstants.getMemberLoginLogDir()+statDate.substring(0, 4)+"/"+statDate.substring(4, 6)+"/"+statDate;
String shellPath=ibcServiceConstants.getHiveShellPath();
pool.execute(new RunShellThread(shellPath, userPath, "loginuser",statDate));
log.info(" run load loginuser data shellPath:= "+shellPath+" ,userPath:= "+userPath);
pool.execute(new RunShellThread(shellPath, accountPath, "loginAccount",statDate));
log.info(" run load loginaccount data shellPath:= "+shellPath+" ,accountPath:= "+accountPath);
pool.execute(new RunShellThread(shellPath, memberPath, "loginmember",statDate));
log.info(" run load loginmember data shellPath:= "+shellPath+" ,memberPath:= "+memberPath);
pool.shutdown();
while(true){
try {
if(pool.isTerminated()){
BigDataTask bigDataTask=CfwConstants.ctx.getBean(BigDataTask.class);
bigDataTask.save(statDate);
break;
}
try {
Thread.sleep(1000l);
} catch (InterruptedException e) {
log.error(" pool error ", e);
}
} catch (Exception e) {
log.error(" pool aa error ", e);
}
}
}