1 16 package net.sf.jftp.system; 17 18 import net.sf.jftp.JFtp; 19 import net.sf.jftp.config.Settings; 20 import net.sf.jftp.gui.*; 21 import net.sf.jftp.gui.base.LocalDir; 22 import net.sf.jftp.gui.base.RemoteDir; 23 import net.sf.jftp.util.*; 24 25 26 public class UpdateDaemon implements Runnable 27 { 28 private static int rem; 29 private static int loc; 30 private static int log; 31 private static int reg; 32 private static int cal; 33 private Thread runner = null; 34 private JFtp jftp; 35 36 public UpdateDaemon(JFtp jftp) 37 { 38 this.jftp = jftp; 39 40 runner = new Thread (this); 41 runner.start(); 42 } 43 44 public static void updateRemoteDirGUI() 45 { 46 reg++; 48 } 49 50 public static void updateRemoteDir() 51 { 52 rem++; 54 } 55 56 public static void updateLocalDir() 57 { 58 loc++; 60 } 61 62 public static void updateLog() 63 { 64 log++; 66 } 67 68 public static void updateCall() 69 { 70 cal++; 71 } 72 73 public void run() 74 { 75 while(true) 76 { 77 try 78 { 79 if(rem > 0) 81 { 82 ((RemoteDir) jftp.remoteDir).fresh(); 83 84 rem = 0; 86 Thread.sleep(100); 87 } 88 89 if(reg > 0) 90 { 91 ((RemoteDir) jftp.remoteDir).gui(true); 92 93 reg = 0; 95 Thread.sleep(100); 96 } 97 98 if(loc > 0) 99 { 100 ((LocalDir) jftp.localDir).fresh(); 101 102 loc = 0; 104 Thread.sleep(100); 105 } 106 107 if(cal > 0) 108 { 109 jftp.fireUpdate(); 110 cal = 0; 111 Thread.sleep(100); 112 } 113 114 if(log > 0) 115 { 116 jftp.ensureLogging(); 117 118 log = 0; 120 Thread.sleep(500); 121 } 122 123 Thread.sleep(Settings.uiRefresh); 124 } 125 catch(Exception ex) 126 { 127 ex.printStackTrace(); 128 System.exit(1); 129 } 130 } 131 } 132 } 133 | Popular Tags |