db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r730187 - 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, 30 Dec 2008 17:19:25 GMT
Author: myrnavl
Date: Tue Dec 30 09:19:25 2008
New Revision: 730187

URL: http://svn.apache.org/viewvc?rev=730187&view=rev
Log:
DERBY-1465; backing out changes after seeing a hang in replicationTests

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=730187&r1=730186&r2=730187&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 30 09:19:25 2008
@@ -62,6 +62,7 @@
 import org.apache.derby.drda.NetworkServerControl;
 import org.apache.derby.security.SystemPermission;
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.jdbc.DRDAServerStarter;
 import org.apache.derby.iapi.reference.Attribute;
 import org.apache.derby.iapi.reference.DRDAConstants;
 import org.apache.derby.iapi.reference.Module;
@@ -83,6 +84,7 @@
 import org.apache.derby.impl.jdbc.Util;
 import org.apache.derby.iapi.jdbc.AuthenticationService;
 import org.apache.derby.iapi.reference.MessageId;
+import org.apache.derby.iapi.security.SecurityUtil;
 import org.apache.derby.mbeans.VersionMBean;
 import org.apache.derby.mbeans.drda.NetworkServerMBean;
 
@@ -330,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 
@@ -641,47 +636,14 @@
 	 *		   
 	 * @exception Exception	throws an exception if an error occurs
 	 */
-	public void start(final PrintWriter consoleWriter)
+	public void start(PrintWriter consoleWriter)
 		throws Exception
 	{
-		completedBoot = false; // reset before we boot 
-		final Exception[] exceptionHolder = new Exception[1]; 
-
-		// 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) { 
-					synchronized (serverStartComplete) {
-						exceptionHolder[0] = e; 
-						serverStartComplete.notifyAll(); 
-					} 
-				} 
-			} 
-		}; 
-
-		// 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(); 
-		// wait until the server has started successfully 
-		// or an error has been detected 
-		synchronized (serverStartComplete) { 
-			while (!completedBoot && exceptionHolder[0] == null) { 
-				serverStartComplete.wait(); 
-			} 
-		} 
-		if (!completedBoot) { 
-			// boot was not successful, throw the exception 
-			throw exceptionHolder[0]; 
-		} 
+		DRDAServerStarter starter = new DRDAServerStarter();
+		starter.setStartInfo(hostAddress,portNumber,consoleWriter);
+        this.setLogWriter(consoleWriter);
+		startNetworkServer();
+		starter.boot(false,null);
 	}
 
 	/**
@@ -738,8 +700,8 @@
 	public void blockingStart(PrintWriter consoleWriter)
 		throws Exception
 	{
-		setLogWriter(consoleWriter);
 		startNetworkServer();
+		setLogWriter(consoleWriter);
 		cloudscapeLogWriter = Monitor.getStream().getPrintWriter();
 		if (SanityManager.DEBUG && debugOutput)
 		{
@@ -757,11 +719,6 @@
 							return createServerSocket();
 						}
 					});
-			synchronized (serverStartComplete) {
-				// now we're sure the boot has completed, so set the flag
-				completedBoot = true;
-				serverStartComplete.notifyAll();
-			}
 		} catch (PrivilegedActionException e) {
 			Exception e1 = e.getException();
 

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=730187&r1=730186&r2=730187&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 30 09:19:25 2008
@@ -54,18 +54,6 @@
         ResultSet rs = stmt
         .executeQuery("Select  tablename   from  sys.systables");
         JDBC.assertDrainResults(rs);
-        
-        // DERBY-1465 - starting another server on the same
-        // port fails
-        try { 
-            serverControl.start(null);
-            fail ("Should have gotten an exception - see DERBY-1465");
-        } catch (Exception e) {
-            if (e.getMessage().indexOf("java.net.BindException") == -1) { 
-                throw e; 
-            } 
-        }
-        
         // Leave the connection open before shutdown
         serverControl.shutdown();
     }



Mime
View raw message