Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何了解工作流程_Java_Process - Fatal编程技术网

Java 如何了解工作流程

Java 如何了解工作流程,java,process,Java,Process,我有一个计时器代码 public void pollPnlFilesFromArgon(final String dirLocation) { Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { Calendar c= Cale

我有一个计时器代码

public void pollPnlFilesFromArgon(final String dirLocation) {
        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new TimerTask() {     
            @Override
            public void run() {
                Calendar c= Calendar.getInstance();
                if(c.get(Calendar.HOUR_OF_DAY)>22 && c.get(Calendar.MINUTE)>=55){
                        this.cancel();                          
                }
                List<String> filesPaths= new ArrayList<String>();
                File folder= new File(dirLocation);
                File[] listOfFiles= folder.listFiles();
                for (File file : listOfFiles) {                 
                    if((file.getName().startsWith("DAILY")||file.getName().startsWith("MONTHLY_Europe")) && file.getName().endsWith(".csv")){
                        filesPaths.add(file.getAbsolutePath());                     
                    }else{
                        if(file.isFile()){
                        File orig=createOrigDir(dirLocation);
                         file.renameTo(new File(orig.getAbsoluteFile()+"/"+file.getName().substring(0,file.getName().length()-4)+"-"+System.currentTimeMillis()+".csv"));
                    }
                    }
                }               
                if(!CollectionUtils.isEmpty(filesPaths)){
                    try {
                        updateBalancePnlFromArgon(filesPaths,dirLocation);
                    } catch (IOException e) {
                        logger.error(e);
                    }                   
                }
            }
        }, 0, 60000);
public void pollPnlFilesFromArgon(最终字符串位置){
定时器=新定时器();
timer.scheduleAtFixedRate(新TimerTask(){
@凌驾
公开募捐{
Calendar c=Calendar.getInstance();
如果(c.get(日历小时数)>22和c.get(日历分钟数)>=55){
这个。取消();
}
List filesPaths=new ArrayList();
文件夹=新文件(目录位置);
File[]listOfFiles=folder.listFiles();
对于(文件:listOfFiles){
if((file.getName().startsWith(“DAILY”)| | file.getName().startsWith(“MONTHLY_Europe”)&&file.getName().endsWith(“.csv”)){
添加(file.getAbsolutePath());
}否则{
if(file.isFile()){
文件orig=createOrigDir(dirLocation);
重命名为(新文件(orig.getAbsoluteFile()+“/”+file.getName().子字符串(0,file.getName().length()-4)+“-”+System.currentTimeMillis()+”.csv));
}
}
}               
如果(!CollectionUtils.isEmpty(filepath)){
试一试{
UpdateBancePNLFromargon(文件路径、目录位置);
}捕获(IOE异常){
错误(e);
}                   
}
}
}, 0, 60000);

这应该在午夜12点开始,晚上11:55结束。如果我想在这段时间内终止进程,我无法在unix中完成。请提供帮助。

unix.stackexchange为您提供了查找作业进程id以及如何终止该进程的方法