[teiid-commits] teiid SVN: r676 - in trunk/server/src/main/java/com/metamatrix: platform/vm/controller and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Mar 31 17:36:17 EDT 2009


Author: rareddy
Date: 2009-03-31 17:36:16 -0400 (Tue, 31 Mar 2009)
New Revision: 676

Modified:
   trunk/server/src/main/java/com/metamatrix/platform/registry/ClusteredRegistryState.java
   trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
   trunk/server/src/main/java/com/metamatrix/server/Main.java
Log:
TEIID-302, TEIID-443: ServiceExceptions were not being logged. The registry was sending the updates to the registry during shutdown, which in turn kicks off the updates of its own, which was causing errors in the JGroups communication. By removing the listeners during the shutdown, it will no longer invoke a unnecessary update.

Modified: trunk/server/src/main/java/com/metamatrix/platform/registry/ClusteredRegistryState.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/registry/ClusteredRegistryState.java	2009-03-31 21:27:02 UTC (rev 675)
+++ trunk/server/src/main/java/com/metamatrix/platform/registry/ClusteredRegistryState.java	2009-03-31 21:36:16 UTC (rev 676)
@@ -317,4 +317,9 @@
 			l.registryChanged();
 		}		
 	}
+	
+	public void shutdown() {
+		this.cache.removeListener();
+		this.listeners.clear();
+	}
 }

Modified: trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java	2009-03-31 21:27:02 UTC (rev 675)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java	2009-03-31 21:36:16 UTC (rev 676)
@@ -353,10 +353,9 @@
                 DeployedComponent depComp = (DeployedComponent) servicesIterator.next();
                 try {
                     startDeployedService(depComp, null, configuration, true);
-                } catch (Exception e) {
+                } catch (ServiceException e) {
                     errored = true;
-                    // error already logged from startDeployedService method.
-                    // continue starting services.
+                    logException(e, e.getMessage());
                 }
             }
             
@@ -369,9 +368,8 @@
                 DeployedComponent depComp = (DeployedComponent) servicesIterator.next();
                 try {
                     startDeployedService(depComp, null, configuration, false);
-                } catch (Exception e) {
-                    // error already logged from startDeployedService method.
-                    // continue starting services.
+                } catch (ServiceException e) {
+                	logException(e, e.getMessage());
                 }
             }
             logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0016, new Integer(deployedServices.size()),  vmComponentDefnID.getName()));
@@ -404,8 +402,7 @@
         try {
             ConfigurationModelContainer configuration = getConfigurationModel();
             startDeployedService(binding.getDeployedComponent(), serviceID, configuration, true);
-
-        } catch (Exception e) {
+        } catch (ConfigurationException e) {
             throw new ServiceException(e, PlatformPlugin.Util.getString(LogMessageKeys.VM_0022, serviceID));
         }
     }
@@ -421,9 +418,8 @@
             VMComponentDefnID vmComponentDefnID = (VMComponentDefnID)this.vmComponentDefn.getID();
             DeployedComponent deployedService = configuration.getConfiguration().getDeployedServiceForVM(defnID, vmComponentDefnID, (HostID) getConfigHost().getID());
             startDeployedService(deployedService, serviceID, configuration, true);
-        } catch (Exception e) {
-            String msg = PlatformPlugin.Util.getString(LogMessageKeys.VM_0024, defnID);
-            throw new ServiceException(e, msg);
+        } catch (ConfigurationException e) {
+            throw new ServiceException(e, PlatformPlugin.Util.getString(LogMessageKeys.VM_0024, defnID));
         }
     }
 
@@ -434,7 +430,7 @@
 	 *  If synch is false then start service asynchronously.
 	 * @throws ConfigurationException 
 	 */
-	private void startDeployedService(DeployedComponent deployedService, ServiceID serviceID, ConfigurationModelContainer configModel, boolean synch) throws ConfigurationException {
+	private void startDeployedService(DeployedComponent deployedService, ServiceID serviceID, ConfigurationModelContainer configModel, boolean synch) {
         Properties defaultProps = null;
         synchronized (this) {
             defaultProps = defaultPropertiesCache.get(deployedService.getComponentTypeID());
@@ -496,9 +492,7 @@
         } catch (ServiceException e) {
             logException(e, e.getMessage());
         } 
-
-		JDBCConnectionPoolHelper.getInstance().shutDown();
-
+	
         // unregister VMController
         events.processRemoved(host.getFullName(), this.processName);
         
@@ -697,16 +691,16 @@
             //add work to the pool
             startServicePool.execute( new Runnable() {
 				public void run() {
-					startService(clientServiceRegistry, serviceID, deployedComponent,serviceClassName, pscID, serviceProps);					
+					try {
+						startService(clientServiceRegistry, serviceID, deployedComponent,serviceClassName, pscID, serviceProps);
+					} catch (ServiceException e) {
+						logException(e, e.getMessage());
+					}					
 				}
             });
         } else {
             //start synchronously
-            try {
-            	startService(clientServiceRegistry, serviceID, deployedComponent,serviceClassName, pscID, serviceProps);
-			} catch (Exception e) {
-				throw new ServiceException(e);
-			}  
+            startService(clientServiceRegistry, serviceID, deployedComponent,serviceClassName, pscID, serviceProps);
         }
     }
     
@@ -804,8 +798,12 @@
                                
             logMessage(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0009, serviceType, serviceInstanceName));
 
-        } catch (Exception e) {
-            throw new ServiceException(e, PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0028, serviceInstanceName));
+        } catch (ClassNotFoundException e) {
+        	throw new ServiceException(e, PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0028, serviceInstanceName));
+        } catch (IllegalAccessException e) {
+        	throw new ServiceException(e, PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0028, serviceInstanceName));
+        } catch (InstantiationException e){
+        	throw new ServiceException(e, PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0028, serviceInstanceName));
         } finally {
         	Thread.currentThread().setContextClassLoader(currentClassLoader);
         }

Modified: trunk/server/src/main/java/com/metamatrix/server/Main.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/Main.java	2009-03-31 21:27:02 UTC (rev 675)
+++ trunk/server/src/main/java/com/metamatrix/server/Main.java	2009-03-31 21:36:16 UTC (rev 676)
@@ -28,6 +28,7 @@
 import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.metamatrix.common.config.CurrentConfiguration;
+import com.metamatrix.common.config.JDBCConnectionPoolHelper;
 import com.metamatrix.common.config.api.Host;
 import com.metamatrix.common.config.api.VMComponentDefn;
 import com.metamatrix.common.config.api.exceptions.ConfigurationException;
@@ -39,6 +40,7 @@
 import com.metamatrix.core.util.StringUtil;
 import com.metamatrix.dqp.ResourceFinder;
 import com.metamatrix.platform.PlatformPlugin;
+import com.metamatrix.platform.registry.ClusteredRegistryState;
 import com.metamatrix.platform.vm.api.controller.ProcessManagement;
 
 /**
@@ -55,6 +57,9 @@
 	@Inject
 	LogListener logListener;
 	
+	@Inject	
+	ClusteredRegistryState registry;
+	
 	public static void main(String[] args) {
         
 		try {
@@ -164,6 +169,8 @@
 		@Override
 		public void run() {
 
+			registry.shutdown();
+			
 			try {
 				messageBus.shutdown();
 			} catch (MessagingException e) {
@@ -175,6 +182,9 @@
      
             // shutdown logging
             logListener.shutdown();
+     
+            // close the connection pool to the DB
+            JDBCConnectionPoolHelper.getInstance().shutDown();            
 		}
     }
 }




More information about the teiid-commits mailing list