mybatis 刷新 xml

new Thread(new java.lang.Runnable(){        	
	        	@Override
	        	public void run() {
	        		// TODO Auto-generated method stub
	        		 File file = new File("D:\\0-aTest\\svntest");    
	     	        //listFiles是獲取該目錄下全部文件和目錄的絕對路徑  
	     	        File[] fs = file.listFiles();
	     	        Long beforLong=System.currentTimeMillis();
	     	        boolean  bl=false;
	     	        
	     	        while(true){
			    	        for (File f : fs){
			    	        	if(!f.isDirectory()){
			    	        		  if(f.lastModified()>beforLong){
			    	        			  System.out.println("被修改的文件是:"+f+"--getAbsolutePath()"+f.getAbsolutePath());
			    	        			  bl=true;
			    	        		  }
			    	        	}
			    	        } 
			    	        if(bl){
			    	        	System.out.println("從新加載文件");
			    	        	bl=false;
			    	        	beforLong=System.currentTimeMillis();			    	        	
			    	        }
			    	        
			    	        try {
								Thread.sleep( 2* 1000);
							} catch (InterruptedException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							}
	     	        }
	        		
	        	}
	        }).start();
	        
	        
	    	try {
				Thread.sleep(1000*1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
 
	    }
相關文章
相關標籤/搜索