| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package com.uas.main;
- import com.uas.util.BaseUtil;
- import com.uas.util.JdbcUtil;
- import static com.uas.main.Upload.*;
- public class Main {
-
- public static void main(String[] args) {
-
- final long timeInterval =5*60*1000;
- Runnable runnable = new Runnable() {
- public void run() {
- while (true) {
- // ------- code for task to run
- a();
- // ------- ends here
- try {
- Thread.sleep(timeInterval);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- };
- Thread thread = new Thread(runnable);
- thread.start();
- }
-
-
-
- public static void a() {
- run();
- System.out.println("begin");
- Download.run();
-
- try{ //关闭数据库连接
- if(JdbcUtil.connection!=null){
- JdbcUtil.connection.close();
- }
- }catch(Exception e){
- BaseUtil.getLogger().error(e.toString());
- e.printStackTrace();
- }finally{
- JdbcUtil.connection = null;
- }
- System.out.println("run over!");
- }
- }
|