Changeset 19003
- Timestamp:
- 2009-04-16T12:43:08+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/greenstone/LocalLibraryServer.java
r18987 r19003 200 200 201 201 // Wait until program has started 202 testServerRunning(); // will set running = true when the server is up and running successfully 202 try { 203 testServerRunning(); // will set running = true when the server is up and running successfully 204 } catch (IOException bad_url_connection) { 205 try { 206 // If this fails then we try changing the url to be localhost 207 Configuration.library_url = new URL(llssite_cfg_file.getLocalHostURL()); 208 DebugStream.println("Try connecting to server on local host: '" + Configuration.library_url + "'"); 209 URLConnection connection = Configuration.library_url.openConnection(); 210 connection.getContent(); 211 running = true; 212 213 } catch (IOException worse_url_connection) { 214 DebugStream.println("Can't connect to server on either address."); 215 Configuration.library_url = null; 216 running = false; 217 } 218 } 203 219 } 204 220 … … 273 289 // This method first tests whether there is a URL in the llssite_cfg_file 274 290 // and after that appears, it tests whether the URL is functional. 275 static private void testServerRunning() {291 static private void testServerRunning() throws IOException { 276 292 // Wait until program has started, by reloading and checking the URL field 277 293 llssite_cfg_file.load(false); … … 305 321 URLConnection connection = Configuration.library_url.openConnection(); 306 322 connection.getContent(); 323 running = true; 307 324 } 308 325 catch (IOException bad_url_connection) { 309 try { 310 // If this fails then we try changing the url to be localhost 311 Configuration.library_url = new URL(llssite_cfg_file.getLocalHostURL()); 312 DebugStream.println("Try connecting to server on local host: '" + Configuration.library_url + "'"); 313 URLConnection connection = Configuration.library_url.openConnection(); 314 connection.getContent(); 315 316 } 317 catch (IOException worse_url_connection) { 318 DebugStream.println("Can't connect to server on either address."); 319 Configuration.library_url = null; 320 return; 321 } 322 } 323 324 running = true; 326 throw bad_url_connection; 327 } 328 329 325 330 } 326 331 … … 345 350 running = false; 346 351 Gatherer.spawnApplication(local_library_server_command, ID); 347 testServerRunning(); // don't return until the webserver is up and running 352 try { 353 testServerRunning(); // don't return until the webserver is up and running 354 } catch (IOException bad_url_connection) { 355 DebugStream.println("Can't connect to server on address " + Configuration.library_url); 356 running = false; 357 } 348 358 } 349 359 }
Note:
See TracChangeset
for help on using the changeset viewer.