List:Commits« Previous MessageNext Message »
From:mmatthews Date:June 27 2006 5:22pm
Subject:Connector/J commit: r5442 - branches/branch_5_0/connector-j/src/com/mysql/jdbc
View as plain text  
Modified:
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java
Log:
Add visibility into whether an attempt to use a master server or not has occurred (for testing).

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java	2006-06-27 17:14:24 UTC (rev 5441)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java	2006-06-27 17:22:27 UTC (rev 5442)
@@ -2607,6 +2607,10 @@
 				}
 
 				for (; hostIndex < this.hostListSize; hostIndex++) {
+					if (hostIndex == 0) {
+						this.hasTriedMasterFlag = true;
+					}
+					
 					try {
 						String newHostPortPair = (String) this.hostList
 								.get(hostIndex);
@@ -2721,7 +2725,10 @@
 				}
 
 				for (; (hostIndex < this.hostListSize) && !connectionGood; hostIndex++) {
-
+					if (hostIndex == 0) {
+						this.hasTriedMasterFlag = true;
+					}
+					
 					if (this.preferSlaveDuringFailover && hostIndex == 0) {
 						hostIndex++;
 					}
@@ -5641,4 +5648,17 @@
 	protected String getErrorMessageEncoding() {
 		return errorMessageEncoding;
 	}
+	
+	/*
+	 * For testing failover scenarios
+	 */
+	private boolean hasTriedMasterFlag = false;
+	
+	public void clearHasTriedMaster() {
+		this.hasTriedMasterFlag = false;
+	}
+	
+	public boolean hasTriedMaster() {
+		return this.hasTriedMasterFlag;
+	}
 }

Thread
Connector/J commit: r5442 - branches/branch_5_0/connector-j/src/com/mysql/jdbcmmatthews27 Jun