[teiid-commits] teiid SVN: r3099 - in trunk/engine/src/main: resources/org/teiid/query and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Apr 18 10:55:32 EDT 2011


Author: shawkins
Date: 2011-04-18 10:55:32 -0400 (Mon, 18 Apr 2011)
New Revision: 3099

Modified:
   trunk/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java
   trunk/engine/src/main/resources/org/teiid/query/i18n.properties
Log:
TEIID-1539 updating the warn logic to happen only based upon time in queue

Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java	2011-04-15 21:22:51 UTC (rev 3098)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/ThreadReuseExecutor.java	2011-04-18 14:55:32 UTC (rev 3099)
@@ -228,6 +228,7 @@
 			return result;
 		}
 	});
+	private long warnWaitTime = 500;
 	
 	public ThreadReuseExecutor(String name, int maximumPoolSize) {
 		this.maximumPoolSize = maximumPoolSize;
@@ -252,7 +253,6 @@
 
 	private void executeDirect(final PrioritizedRunnable command) {
 		boolean atMaxThreads = false;
-		boolean newMaxQueueSize = false;
 		synchronized (poolLock) {
 			checkForTermination();
 			submittedCount++;
@@ -261,7 +261,6 @@
 				queue.add(command);
 				int queueSize = queue.size();
 				if (queueSize > highestQueueSize) {
-					newMaxQueueSize = true;
 					highestQueueSize = queueSize;
 				}
 			} else {
@@ -270,9 +269,6 @@
 			}
 		}
 		if (atMaxThreads) {
-			if (newMaxQueueSize && maximumPoolSize > 1) {
-				LogManager.logWarning(LogConstants.CTX_RUNTIME, QueryPlugin.Util.getString("WorkerPool.Max_thread", maximumPoolSize, poolName, highestQueueSize)); //$NON-NLS-1$
-			}
 			return;
 		}
 		tpe.execute(new Runnable() {
@@ -285,7 +281,7 @@
 				if (LogManager.isMessageToBeRecorded(LogConstants.CTX_RUNTIME, MessageLevel.TRACE)) {
 					LogManager.logTrace(LogConstants.CTX_RUNTIME, "Beginning work with virtual worker", t.getName()); //$NON-NLS-1$ 
 				}
-				Runnable r = command;
+				PrioritizedRunnable r = command;
 				while (r != null) {
 					boolean success = false;
 					try {
@@ -305,6 +301,11 @@
 								}		
 							}
 						}
+						long warnTime = warnWaitTime;
+						if (r != null && System.currentTimeMillis() - r.getCreationTime() > warnTime) {
+							LogManager.logWarning(LogConstants.CTX_RUNTIME, QueryPlugin.Util.getString("WorkerPool.Max_thread", maximumPoolSize, poolName, highestQueueSize, warnTime)); //$NON-NLS-1$
+							warnWaitTime*=2; //we don't really care if this is synchronized
+						}
 						t.setName(name);
 					}
 				}

Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2011-04-15 21:22:51 UTC (rev 3098)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2011-04-18 14:55:32 UTC (rev 3099)
@@ -737,7 +737,7 @@
 SetClause.resolvingError=Cannot set symbol ''{1}'' with expected type {2} to expression ''{0}''
 NewCalculateCostUtil.badCost=Unexpected format encountered for max or min value
 
-WorkerPool.Max_thread=Reached maximum thread count "{0}" for worker pool "{1}" with a queue size of "{2}". To avoid queuing of work you may consider increasing of "maxThreads" property in "teiid-jboss-beans.xml" file in the "RuntimeEngineDeployer" section.   
+WorkerPool.Max_thread=Reached maximum thread count "{0}" for worker pool "{1}" with a queue size high of "{2}". Queued work waited {3} ms prior to executing. To avoid queuing of work you may consider increasing "RuntimeEngineDeployer.maxThreads" or decreasing the "RuntimeEngineDeployer.maxActivePlans" in the "teiid-jboss-beans.xml" file.   
 WorkerPool.uncaughtException=Uncaught exception processing work
 
 



More information about the teiid-commits mailing list