Changeset 14538
- Timestamp:
- 2007-09-18T15:10:08+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/greenstone3/ServletConfiguration.java
r14323 r14538 40 40 import java.io.*; 41 41 import java.lang.ref.*; 42 import java.lang.Thread; 42 43 import java.net.*; 43 44 import java.util.*; … … 65 66 private HashMap mappings = null; 66 67 67 public ServletConfiguration(String gsdl3_path) {68 public ServletConfiguration(String gsdl3_path) throws InterruptedException { 68 69 69 70 this.gsdl3_path = gsdl3_path; 70 71 71 72 if (Gatherer.isGsdlRemote){ 72 if (RemoteGreenstoneServer.downloadWebXMLFile().equals("")) { 73 System.err.println("Error: Could not download web.xml."); 74 System.exit(0); 75 } 76 } 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 } 108 } 109 System.out.println("The web.xml file has been downloaded"); 110 } 111 77 112 //String web_xml_path = gsdl3_path + File.separator + "web" + File.separator + "WEB-INF"+ File.separator + "web.xml"; 78 113 File web_xml; … … 184 219 return site; 185 220 } 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 186 231 }
Note:
See TracChangeset
for help on using the changeset viewer.