Index: main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 29356)
+++ main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 29361)
@@ -744,5 +744,7 @@
 			    p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "ant stop -f \"" + Configuration.gsdl3_src_path + File.separator + "build.xml\""});
 			}
-			if(p != null && p.waitFor() == 0) {
+			// doing a p.waitFor() without processing the Process' IOstreams causes blocking with Java 6 
+			// (i.e. when JRE 6 included with GS binaries). However, p.waitFor() with Java 7 is fine.
+			/*if(p != null && p.waitFor() == 0) {
 			    DebugStream.println("********** SUCCESSFULLY stopped THE GS3 SERVER ON EXIT");
 			}
@@ -750,5 +752,5 @@
 			    System.err.println("********** FAILED TO SUCCESSFULLY stop THE GS3 SERVER ON EXIT");
 			    //throw new Exception ("Failed to successfully stop the GS3 server on exit.");
-			}
+			}*/
 		    } catch(Exception e) {
 			System.err.println("Exception when trying to stop the tomcat web server: " + e);
Index: main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java	(revision 29356)
+++ main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java	(revision 29361)
@@ -1755,11 +1755,8 @@
 		GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl3_src_path, "restart");
 		thread.start();
-
-		// sleep before returning and doing the configGS3Server: give the GS3 server time to restart	
-		try {
-		    Thread.sleep(5000);
-		} catch(Exception e) {
-		    e.printStackTrace();
-		}
+		
+		// Give the GS3 server time to restart:
+		// the GS3ServerThread above waits for the process to terminate. ant restart target calls the start-tomcat ant target
+		// and that takes waits 5 seconds and polls to see if a GS3 server index page has loaded. So no need to sleep here		
 		
 	    }
@@ -2038,18 +2035,4 @@
 	    return true;
 	}
-
-	if(CollectionManager.isSolrCollection()) {
-	    // No installCollection() for GS3 solr collection: activate will take care of that
-	    DebugStream.println("Solr collection build complete: building already moved to index by activate.pl.");
-
-	    // Finished building,
-	    // For now, for a GS3 solr collection, we'd have stopped the GS3 server before building
-	    // and will now need to restart it.
-	    GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl3_src_path, "restart");
-	    thread.start();
-
-	    return true;
-	}
-
 
 	DebugStream.println("Build complete. Moving files.");
Index: main/trunk/gli/src/org/greenstone/gatherer/util/GS3ServerThread.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/util/GS3ServerThread.java	(revision 29356)
+++ main/trunk/gli/src/org/greenstone/gatherer/util/GS3ServerThread.java	(revision 29361)
@@ -78,8 +78,29 @@
 
 		if (p != null) {
-		    int result = p.waitFor();
-		    if(result != 0) {
+			// in order for the process.waitFor() method to work with Java 6 (JRE 6 is included in GS binaries)
+			// need to make sure the IOstreams of the process are not blocked. For Java 7, this is not necessary
+			// and a waitFor() is sufficient. But with Java 6, the waitFor() causes the server to finally start
+			// after the user has quit GLI.
+		
+			// Process takes no input, but we will still catch this iostream too
+			// And we'll catch the error and output streams to prevent them from blocking during waitFor()
+			// (For normal input and output stream handling using the Gobblers, see FormatConversionDialog.java)
+			OutputStreamGobbler inputGobbler = new OutputStreamGobbler(p.getOutputStream(), null);			
+            InputStreamGobbler errorGobbler = new InputStreamGobbler(p.getErrorStream(), true);
+            InputStreamGobbler outputGobbler = new InputStreamGobbler(p.getInputStream());
+            
+            errorGobbler.start();
+            outputGobbler.start();
+			inputGobbler.start();
+			
+			// the important part: wait for the process (ant stop or start or re-start to terminate)
+			int result = p.waitFor();
+			if(result != 0) {
 			System.err.println("**** Failed to successfully " + _ant_command + " the GS3 server.");
-		    }
+			}		
+			
+			outputGobbler.join();
+			errorGobbler.join();
+			inputGobbler.join();
 		} else {
 		    System.err.println("**** Could not start the Process to " + _ant_command + " the GS3 server.");
Index: main/trunk/gli/src/org/greenstone/gatherer/util/OutputStreamGobbler.java
===================================================================
--- main/trunk/gli/src/org/greenstone/gatherer/util/OutputStreamGobbler.java	(revision 29356)
+++ main/trunk/gli/src/org/greenstone/gatherer/util/OutputStreamGobbler.java	(revision 29361)
@@ -51,4 +51,9 @@
     public void run()
     {
+	
+	if (inputstr == null) {
+		return;
+	}
+	
 	BufferedWriter osw = null;
 	try	{
