Changeset 14592
- Timestamp:
- 2007-09-28T11:12:24+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/greenstone3/ServletConfiguration.java
r14538 r14592 40 40 import java.io.*; 41 41 import java.lang.ref.*; 42 import java.lang.Thread;43 42 import java.net.*; 44 43 import java.util.*; … … 66 65 private HashMap mappings = null; 67 66 68 public ServletConfiguration(String gsdl3_path) throws InterruptedException{67 public ServletConfiguration(String gsdl3_path) { 69 68 70 69 this.gsdl3_path = gsdl3_path; 71 70 72 71 if (Gatherer.isGsdlRemote){ 73 // if (RemoteGreenstoneServer.downloadWebXMLFile().equals("")) { 74 //System.err.println("Error: Could not download web.xml."); 75 //System.exit(0); 76 //} 77 System.out.println("Starting download web.xml."); 78 long startTime = System.currentTimeMillis(); 79 long patience = 1000 * 10; 80 Thread t = new Thread(new downloadWebXMl()); 81 t.start(); 82 83 System.out.println("Waiting for download thread to finish"); 84 while (t.isAlive()) { 85 System.out.println("Still waiting..."); 86 //Wait maximum of 1 second for MessageLoop thread to 87 //finish. 88 t.join(1000); 89 if (((System.currentTimeMillis() - startTime) > patience) && 90 t.isAlive()) { 91 //t.interrupt(); 92 //Shouldn't be long now -- wait indefinitely 93 //t.join(); 94 System.out.print("Have been waiting 10 seconds for connecting to the server, do you want to terminate the connection?(y/n)"); 95 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 96 try { 97 if (br.readLine().toLowerCase().startsWith("y")){ 98 System.out.println("Terminate the connection! "); 99 System.exit(0); 100 }else{ 101 startTime = System.currentTimeMillis(); 102 }; 103 } catch (IOException ioe) { 104 System.out.println("IO error trying to read your answer!"); 105 System.exit(1); 106 } 107 } 72 if (RemoteGreenstoneServer.downloadWebXMLFile().equals("")) { 73 System.err.println("Error: Could not download web.xml."); 74 System.exit(0); 108 75 } 109 System.out.println("The web.xml file has been downloaded");110 76 } 111 112 77 //String web_xml_path = gsdl3_path + File.separator + "web" + File.separator + "WEB-INF"+ File.separator + "web.xml"; 113 78 File web_xml; … … 219 184 return site; 220 185 } 221 222 private static class downloadWebXMl implements Runnable {223 public void run() {224 if (RemoteGreenstoneServer.downloadWebXMLFile().equals("")) {225 System.err.println("Error: Could not download web.xml.");226 System.exit(0);227 }228 }229 }230 231 186 }
Note:
See TracChangeset
for help on using the changeset viewer.