关于java 操作linux命令的 一些相关


     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);
}
}
}


//spring注解给属性付初始值
@Value("${hive.load.data.shell}")
public void setHiveShellPath(String hiveShellPath) {
this.hiveShellPath = hiveShellPath;
} public String getMemberLoginLogDir() {
return memberLoginLogDir;
}
@Value("${memberlogin.log.hadoop.dir}")
public void setMemberLoginLogDir(String memberLoginLogDir) {
this.memberLoginLogDir = memberLoginLogDir;
}
另一种方法 https://blog.csdn.net/jiaomicha/article/details/40539523
上一篇:C#用DesignSurface实现一个简单的窗体设计器


下一篇:DBeaver显示系统数据库不全