db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r722639 - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSinSameJVMTest.java
Date Tue, 02 Dec 2008 22:25:01 GMT
Author: myrnavl
Date: Tue Dec  2 14:25:01 2008
New Revision: 722639

URL: http://svn.apache.org/viewvc?rev=722639&view=rev
Log:
DERBY-1465; backing out changes of revision 718616; they cause an intermittent
  hang.

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSinSameJVMTest.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java?rev=722639&r1=722638&r2=722639&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
(original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Tue Dec  2 14:25:01 2008
@@ -232,7 +232,6 @@
 	private String encPrvArg;
 	private String hostArg = DEFAULT_HOST;	
 	private InetAddress hostAddress;
-	private Exception runtimeException=null;
 	private int sessionArg;
 	private boolean unsecureArg;
 
@@ -333,13 +332,6 @@
 	private static final int SSL_PEER_AUTHENTICATION = 2;
 
 	private int sslMode = SSL_OFF;
-    
-	/* object to wait on and notify; so we can monitor if a server
-	 * was successfully started */
-	private Object serverStartComplete = new Object();
-
-	/* for flagging complete boot */
-	private boolean completedBoot = false;
 
     /**
      * Can EUSRIDPWD security mechanism be used with 
@@ -644,37 +636,14 @@
 	 *		   
 	 * @exception Exception	throws an exception if an error occurs
 	 */
-	public void start(final PrintWriter consoleWriter)
+	public void start(PrintWriter consoleWriter)
 		throws Exception
 	{
-		// creating a new thread and calling blockingStart on it
-		// This is similar to calling DRDAServerStarter.boot().
-		// We save any exception from the blockingStart and 
-		// return to the user later. See DERBY-1465.
-		Thread t = new Thread("NetworkServerControl") {
-
-		public void run() {
-			try {
-				blockingStart(consoleWriter);
-			} catch (Exception e) {
-				runtimeException = e;
-			}
-		}
-	};
-		// make it a daemon thread so it exits when the jvm exits
-		t.setDaemon(true);
-		// if there was an immediate error like
-		// another server already running, throw it here.
-		// ping is still required to verify the server is
-		// up.     
-
-		t.start();
-		synchronized(serverStartComplete){
-		while (!completedBoot )
-			serverStartComplete.wait();
-		}
-		if (runtimeException != null)
-			throw runtimeException; 
+		DRDAServerStarter starter = new DRDAServerStarter();
+		starter.setStartInfo(hostAddress,portNumber,consoleWriter);
+        this.setLogWriter(consoleWriter);
+		startNetworkServer();
+		starter.boot(false,null);
 	}
 
 	/**
@@ -731,8 +700,8 @@
 	public void blockingStart(PrintWriter consoleWriter)
 		throws Exception
 	{
-		setLogWriter(consoleWriter);
 		startNetworkServer();
+		setLogWriter(consoleWriter);
 		cloudscapeLogWriter = Monitor.getStream().getPrintWriter();
 		if (SanityManager.DEBUG && debugOutput)
 		{
@@ -777,11 +746,6 @@
 		// If we find other (unexpected) errors, we ultimately exit--so make
 		// sure we print the error message before doing so (Beetle 5033).
 			throwUnexpectedException(e);
-		} finally {
-			synchronized (serverStartComplete) {
-				completedBoot = true;
-				serverStartComplete.notifyAll();
-			}
 		}
         
 		switch (getSSLMode()) {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSinSameJVMTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSinSameJVMTest.java?rev=722639&r1=722638&r2=722639&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSinSameJVMTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSinSameJVMTest.java
Tue Dec  2 14:25:01 2008
@@ -54,17 +54,6 @@
         ResultSet rs = stmt
         .executeQuery("Select  tablename   from  sys.systables");
         JDBC.assertDrainResults(rs);
-        
-        // DERBY-1465 - starting another server on the same
-        // port fails and should throw an exception as well as log it
-        try { 
-            serverControl.start(null);
-            // commenting out until intermittent failure has been resolved.
-	    //fail ("Should have gotten an exception - see DERBY-1465");
-        } catch (Exception e) {
-            assertTrue(e.getMessage().indexOf("java.net.BindException") > 1);
-        }
-        
         // Leave the connection open before shutdown
         serverControl.shutdown();
     }



Mime
View raw message