[teiid-commits] teiid SVN: r535 - in trunk: console/src/main/java/com/metamatrix/console/ui/views/runtime and 6 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Mar 3 18:23:07 EST 2009


Author: rareddy
Date: 2009-03-03 18:23:06 -0500 (Tue, 03 Mar 2009)
New Revision: 535

Modified:
   trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/RuntimeStateAdminAPI.java
   trunk/console/src/main/java/com/metamatrix/console/ui/views/runtime/QueueStatisticsRefreshRequestHandlerImp.java
   trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java
   trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java
   trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java
   trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIImpl.java
   trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/VMControllerInterface.java
   trunk/server/src/main/java/com/metamatrix/platform/vm/controller/VMController.java
   trunk/server/src/main/java/com/metamatrix/server/HostController.java
   trunk/server/src/main/java/com/metamatrix/server/Main.java
   trunk/server/src/main/java/com/metamatrix/server/ServiceManager.java
Log:
TEIID-394: removed verbose methods on the VMControllerInterface. Functionality wise we only lost runGC, but that be done using jmx bean

Modified: trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/RuntimeStateAdminAPI.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/RuntimeStateAdminAPI.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/common-internal/src/main/java/com/metamatrix/platform/admin/api/RuntimeStateAdminAPI.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -182,43 +182,8 @@
                                                  InvalidSessionException,
                                                  MetaMatrixComponentException;
 
-    /**
-     * Stop all services, in a process, once work is complete.
-     * 
-     * @param callerSessionID
-     *            ID of the caller's current session.
-     * @param serviceID
-     *            ID of service instance.
-     * @throws AuthorizationException
-     *             if caller is not authorized to perform this method.
-     * @throws InvalidSessionException
-     *             if the <code>callerSessionID</code> is not valid or is expired.
-     * @throws MetaMatrixComponentException
-     *             if an error occurred in communicating with a component.
-     */
-    void stopAllServicesInAProcess(VMControllerID processID) throws AuthorizationException,
-                                                            InvalidSessionException,
-                                                            MetaMatrixComponentException;
 
     /**
-     * Stop all services, in a process, now.
-     * 
-     * @param callerSessionID
-     *            ID of the caller's current session.
-     * @param serviceID
-     *            ID of service instance.
-     * @throws AuthorizationException
-     *             if caller is not authorized to perform this method.
-     * @throws InvalidSessionException
-     *             if the <code>callerSessionID</code> is not valid or is expired.
-     * @throws MetaMatrixComponentException
-     *             if an error occurred in communicating with a component.
-     */
-    void stopAllServicesInAProcessNow(VMControllerID processID) throws AuthorizationException,
-                                                               InvalidSessionException,
-                                                               MetaMatrixComponentException;
-
-    /**
      * Gracefully shutdown server waiting for work to complete.
      * 
      * @param callerSessionID
@@ -549,22 +514,6 @@
                                                      MetaMatrixComponentException;
 
     /**
-     * Run Garbage collection on process.
-     * 
-     * @param VMControllerID
-     *            ID of the process.
-     * @throws AuthorizationException
-     *             if caller is not authorized to perform this method.
-     * @throws InvalidSessionException
-     *             if the <code>callerSessionID</code> is not valid or is expired.
-     * @throws MetaMatrixComponentException
-     *             if an error occurred in communicating with a component.
-     */
-    void runGC(VMControllerID vmID) throws AuthorizationException,
-                                   InvalidSessionException,
-                                   MetaMatrixComponentException;
-
-    /**
      * Return the PscID by Name
      * 
      * @param hostName

Modified: trunk/console/src/main/java/com/metamatrix/console/ui/views/runtime/QueueStatisticsRefreshRequestHandlerImp.java
===================================================================
--- trunk/console/src/main/java/com/metamatrix/console/ui/views/runtime/QueueStatisticsRefreshRequestHandlerImp.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/console/src/main/java/com/metamatrix/console/ui/views/runtime/QueueStatisticsRefreshRequestHandlerImp.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -92,13 +92,7 @@
 	}
 
     public void runGarbageCollection(ProcessData pd) {
-        try {
-            //api = getAdminAPI();
-            VMControllerID cntrlrID = pd.getProcessID();
-            getAdminAPI().runGC(cntrlrID);
-        } catch (Exception theException) {
-            displayException(theException, "QueueStatisticsRefreshRequestHandlerImp.runGarbageCollection"); //$NON-NLS-1$
-        }
+    	// we no longer support this.
     }
 
     private RuntimeStateAdminAPI getAdminAPI() {

Modified: trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -417,11 +417,7 @@
         
         try {
 			VMControllerInterface vmController = getVMControllerInterface(serviceID.getVMControllerID());
-			if (stopNow) {
-			    vmController.shutdownServiceNow(serviceID);
-			} else {
-			    vmController.shutdownService(serviceID);
-			}
+		    vmController.stopService(serviceID, stopNow, true);
 		} catch (MetaMatrixComponentException e) {
 			throw new AdminComponentException(e);
 		}

Modified: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -81,8 +81,9 @@
         super(host, vmName, vmId, registry, serverEvents, bus, hostManagement);
     }
 
-	public void startVM() {
-		super.startVM();
+    @Override
+	public void start() {
+		super.start();
 		
 		waitForServices();
         
@@ -92,7 +93,8 @@
     
     // extend the VMController method to close the socket at the start of the stop process
     // so that the port can be made available sooner on bounces.
-    protected void doStopVM(boolean now, boolean shutdown) {
+    @Override
+    public void shutdown(boolean now) {
         if (workerPool != null) {
             try {
                 workerPool.shutdownNow();                
@@ -113,9 +115,9 @@
                 listener = null;
             }
         }
-        
-        super.doStopVM(now, shutdown);
 
+        // call the base class.
+        super.shutdown(now);
     }        
     
     /** 

Modified: trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIHelper.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -401,7 +401,7 @@
                             // if not deployed but running then kill, kill, kill
                             if (!sData.isDeployed() && sData.isRegistered()) {
                                 try {
-                                    vmController.shutdownService(sData.getServiceID());
+                                    vmController.stopService(sData.getServiceID(), false, true);
                                 } catch (Exception e) {
                                     exceptions.add(e);
                                 }
@@ -487,7 +487,7 @@
         
         VMControllerInterface vmController = vmBinding.getVMController();
         try {
-        	vmController.stopService(serviceID);
+        	vmController.stopService(serviceID, false, false);
         } catch (ServiceException se) {
         	LogManager.logDetail(LogPlatformConstants.CTX_RUNTIME_ADMIN, se, "Service exception stopping service during restart"); //$NON-NLS-1$
         }
@@ -573,11 +573,7 @@
         VMRegistryBinding binding = registry.getVM(vmID.getHostName(), vmID.toString());
         VMControllerInterface vmController = binding.getVMController();
         try {
-            if (stopNow) {
-                vmController.stopServiceNow(serviceID);
-            } else {
-                vmController.stopService(serviceID);
-            }
+        	vmController.stopService(serviceID, stopNow, false);
         } catch (ServiceException se) {
             throw new MetaMatrixComponentException(se);
         }

Modified: trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIImpl.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/platform/admin/apiimpl/RuntimeStateAdminAPIImpl.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -364,76 +364,6 @@
 
   
     /**
-     * Stop all services, in a process, once work is complete.
-     * 
-     * @param serviceID
-     *            ID of service instance.
-     * @throws AuthorizationException
-     *             if caller is not authorized to perform this method.
-     * @throws InvalidSessionException
-     *             if the <code>callerSessionID</code> is not valid or is expired.
-     * @throws MetaMatrixComponentException
-     *             if an error occurred in communicating with a component.
-     */
-    public synchronized void stopAllServicesInAProcess(VMControllerID processID) throws AuthorizationException,
-                                                                                InvalidSessionException,
-                                                                                MetaMatrixComponentException {
-
-        // Validate caller's session
-        SessionToken token = AdminAPIHelper.validateSession(getSessionID());
-        I18nLogManager.logInfo(LogPlatformConstants.CTX_RUNTIME_ADMIN, LogMessageKeys.ADMIN_0013, new Object[] {
-            processID, token.getUsername()
-        });
-
-        // Validate caller's role
-        AdminAPIHelper.checkForRequiredRole(token, AdminRoles.RoleName.ADMIN_PRODUCT, "RuntimeStateAdminAPIImpl.stopAllServicesInAProcess(" + processID + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-
-        VMControllerInterface vmController = helper.getVMControllerInterface(processID);
-        try {
-            vmController.stopAllServices();
-        } catch (ServiceException se) {
-            throw new MetaMatrixComponentException(se);
-        } catch (MultipleException se) {
-            throw new MetaMatrixComponentException(se);
-        }
-    }
-
-    /**
-     * Stop all services, in a process, now.
-     * 
-     * @param serviceID
-     *            ID of service instance.
-     * @throws AuthorizationException
-     *             if caller is not authorized to perform this method.
-     * @throws InvalidSessionException
-     *             if the <code>callerSessionID</code> is not valid or is expired.
-     * @throws MetaMatrixComponentException
-     *             if an error occurred in communicating with a component.
-     */
-    public synchronized void stopAllServicesInAProcessNow(VMControllerID processID) throws AuthorizationException,
-                                                                                   InvalidSessionException,
-                                                                                   MetaMatrixComponentException {
-
-        // Validate caller's session
-        SessionToken token = AdminAPIHelper.validateSession(getSessionID());
-        I18nLogManager.logInfo(LogPlatformConstants.CTX_RUNTIME_ADMIN, LogMessageKeys.ADMIN_0014, new Object[] {
-            processID, token.getUsername()
-        });
-
-        // Validate caller's role
-        AdminAPIHelper.checkForRequiredRole(token, AdminRoles.RoleName.ADMIN_PRODUCT, "RuntimeStateAdminAPIImpl.stopAllServicesInAProcessNow(" + processID + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-
-        VMControllerInterface vmController = helper.getVMControllerInterface(processID);
-        try {
-            vmController.stopAllServicesNow();
-        } catch (ServiceException se) {
-            throw new MetaMatrixComponentException(se);
-        } catch (MultipleException me) {
-            throw new MetaMatrixComponentException(me);
-        }
-    }
-
-    /**
      * Gracefully shutdown server waiting for work to complete.
      * 
      * @throws AuthorizationException
@@ -807,11 +737,7 @@
             try {
                 ServiceID serviceID = serviceData.getServiceID();
                 if (serviceID != null) {
-                    if (now) {
-                        vm.stopServiceNow(serviceID);
-                    } else {
-                        vm.stopService(serviceID);
-                    }
+                    vm.stopService(serviceID, now, false);
                 }
             } catch (ServiceException se) {
                 exceptions.add(se);
@@ -1037,31 +963,6 @@
     }
 
     /**
-     * Run Garbage Collection on Process.
-     * 
-     * @param VMControllerID
-     *            ID of the process.
-     * @throws AuthorizationException
-     *             if caller is not authorized to perform this method.
-     * @throws InvalidSessionException
-     *             if the <code>callerSessionID</code> is not valid or is expired.
-     * @throws MetaMatrixComponentException
-     *             if an error occurred in communicating with a component.
-     */
-    public synchronized void runGC(VMControllerID vmID) throws AuthorizationException,
-                                                       InvalidSessionException,
-                                                       MetaMatrixComponentException {
-
-        // Validate caller's session
-        SessionToken token = AdminAPIHelper.validateSession(getSessionID());
-        LogManager.logDetail(LogPlatformConstants.CTX_RUNTIME_ADMIN, "Running GarbageCollector on " + vmID + " user = " + token.getUsername()); //$NON-NLS-1$ //$NON-NLS-2$
-
-        // Any administrator may call this read-only method - no need to validate role
-        VMControllerInterface vm = helper.getVMControllerInterface(vmID);
-        vm.runGC();
-    }
-
-    /**
      * @see com.metamatrix.platform.admin.apiimpl.RuntimeStateAdminAPI#getServiceIDByName(java.lang.String,
      *      java.lang.String, java.lang.String)
      * @since 4.2.1

Modified: trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/VMControllerInterface.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/VMControllerInterface.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/api/controller/VMControllerInterface.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -26,7 +26,6 @@
 import java.util.Date;
 
 import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.api.exception.MultipleException;
 import com.metamatrix.common.config.api.ServiceComponentDefnID;
 import com.metamatrix.common.log.LogConfiguration;
 import com.metamatrix.platform.service.api.ServiceID;
@@ -38,8 +37,15 @@
 	/**
 	 * Starts the VM by invoking all the deployed services
 	 */
-	public void startVM();
+	public void start();
 	
+	
+    /**
+     * Shut down all services waiting for work to complete.
+     * Essential services will also be shutdown.
+     */
+    void shutdown(boolean now);
+    
 	/**
 	 *  Start the service identified by the ServiceComponentID
 	 *  If synch is true then wait for service to start before returning.
@@ -53,37 +59,13 @@
 	 */
 	void startService(ServiceID serviceID);
 
-	/**
-	 * Kill all services (waiting for work to complete) and then kill the vm.
-	 */
-	void stopVM();
 
 	/**
-	 * Kill all services now, do not wait for work to complete
-	 */
-	void stopVMNow();
-
-	/**
 	 * Kill service once work is complete
 	 */
-	void stopService(ServiceID id);
+	void stopService(ServiceID id, boolean now, boolean shutdown);
 
-	/**
-	 * Kill service now!!!
-	 */
-	void stopServiceNow(ServiceID id);
-
     /**
-     * Kill all services once work is complete
-     */
-    void stopAllServices() throws MultipleException;
-
-    /**
-     * Kill all services now
-     */
-    void stopAllServicesNow() throws MultipleException;
-    
-    /**
      * Check the state of a service
      */
     void checkService(ServiceID serviceID);
@@ -119,30 +101,6 @@
 	void ping();
 
     /**
-     * Shut down all services waiting for work to complete.
-     * Essential services will also be shutdown.
-     */
-    void shutdown();
-
-    /**
-     * Shut down all services without waiting for work to complete.
-     * Essential services will also be shutdown.
-     */
-    void shutdownNow();
-
-    /**
-     * Shut down service waiting for work to complete.
-     * Essential services will also be shutdown.
-     */
-    void shutdownService(ServiceID serviceID) ;
-
-    /**
-     * Shut down all services without waiting for work to complete.
-     * Essential services will also be shutdown.
-     */
-    void shutdownServiceNow(ServiceID serviceID);
-
-    /**
      * Returns true if system is being shutdown.
      */
     boolean isShuttingDown();
@@ -159,12 +117,6 @@
     void dumpThreads();
 
     /**
-     * Run GC on vm.
-     */
-    void runGC() ;
-
-    
-    /**
      * Export the server logs to a byte[].  The bytes contain the contents of a .zip file containing the logs. 
      * This will export all logs on the host that contains this VMController.
      * @return the logs, as a byte[].

Modified: trunk/server/src/main/java/com/metamatrix/platform/vm/controller/VMController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/vm/controller/VMController.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/platform/vm/controller/VMController.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -263,7 +263,7 @@
         Runtime.getRuntime().addShutdownHook(new Thread() {
             public void run() {
             	try {
-					shutdown();
+					shutdown(false);
 				} catch (Exception e) {
 					// ignore
 				}
@@ -333,7 +333,7 @@
         return id;
     }
 
-	public void startVM() {
+	public void start() {
     			
         logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0013));
         VMComponentDefnID vmComponentDefnID = (VMComponentDefnID)this.vmComponentDefn.getID();
@@ -497,26 +497,31 @@
         }
 
     }
+	
+    /**
+     * Shut down all services waiting for work to complete.
+     * Essential services will also be shutdown.
+     */
+	public synchronized void shutdown(boolean now) {
+		logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0041));
+		
+		try {
+            stopServices(now, true);
+        } catch (MultipleException e) {
+        	logException(e, e.getMessage());
+        } catch (ServiceException e) {
+            logException(e, e.getMessage());
+        } 
 
-	/**
-	 * Kill all services (waiting for work to complete) and then kill the vm.
-	 */
-	public void stopVM() {
-        logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0029));
-        doStopVM(false, false);
-    }
+		JDBCConnectionPoolHelper.getInstance().shutDown();
 
-
-	protected void doStopVM(boolean now, boolean shutdown) {
-
-	    stop(now, shutdown);
+        // unregister VMController
+        events.vmRemoved(id);
         
-		// If running inside an app server then get a defaul context.
-		String propVal = System.getProperty(CommonPropertyNames.APP_SERVER_VM);
-		if (propVal != null && propVal.equalsIgnoreCase("true")) { //$NON-NLS-1$
-			return;
-		}
+        this.shuttingDown = true;
 
+        notifyAll();        
+        
 		this.startServicePool.execute(new Runnable() {
             public void run() {
                 // Wait before killing the VM.
@@ -529,135 +534,22 @@
         });
     }
 
-	private synchronized void stop(boolean now, boolean shutdown) {
-		try {
-            stopServices(now, shutdown);
-        } catch (MultipleException e) {
-        	logException(e, e.getMessage());
-        } catch (ServiceException e) {
-            logException(e, e.getMessage());
-        } 
 
-		JDBCConnectionPoolHelper.getInstance().shutDown();
-
-        // unregister VMController
-        events.vmRemoved(id);
-	}
-
 	/**
-	 * Kill all services now, do not wait for work to complete, do not collect $200
-	 */
-	public void stopVMNow() {
-        logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0034));
-        doStopVM(true, false);
-    }
-
-	/**
 	 * Kill service once work is complete
 	 */
-	public void stopService(ServiceID id) {
+	public void stopService(ServiceID id, boolean now, boolean shutdown) {
         try {
 			logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0035, id));
 			validateServiceID(id);
 			ServiceRegistryBinding binding = this.registry.getServiceBinding(id.getHostName(), id.getVMControllerID().toString(), id);
-			stopService(binding, false, false);
+			stopService(binding, now, shutdown);
 		} catch (ResourceNotBoundException e) {
 			throw new ServiceException(e);
 		}
     }
 
-	/**
-	 * Kill service now!!!
-	 */
-	public void stopServiceNow(ServiceID id) {
-        try {
-			logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0036, id));
-			validateServiceID(id);
-			ServiceRegistryBinding binding = this.registry.getServiceBinding(id.getHostName(), id.getVMControllerID().toString(), id);        
-			stopService(binding, true, false);
-		} catch (ResourceNotBoundException e) {
-			throw new ServiceException(e);			
-		}
-    }
-
-	/**
-	 * Kill services now!!!
-	 */
-	public void stopAllServicesNow() throws MultipleException {
-        logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0037));
-        stopServices(true, false);
-    }
-
-	/**
-	 * Kill services
-	 */
-	public void stopAllServices() throws MultipleException {
-        logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0038));
-        stopServices(false, false);
-    }
-
-    
     /**
-     * Shut down all services waiting for work to complete.
-     * Essential services will also be shutdown.
-     */
-    public void shutdown(){
-        logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0040));
-        doStopVM(false, true);
-    }
-
-    /**
-     * Shut down all services without waiting for work to complete.
-     * Essential services will also be shutdown.
-     */
-    public synchronized void shutdownNow() {
-        logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0041));
-        doStopVM(true, true);
-        this.shuttingDown = true;
-        notifyAll();
-    }
-
-    public void shutdownService(ServiceID serviceID) {
-    	shutdownService(serviceID, false);
-    }    
-
-    /**
-     * Shut down service without waiting for work to complete.
-     * Essential services will also be shutdown.
-     */
-    public void shutdownServiceNow(ServiceID serviceID) {
-    	shutdownService(serviceID, true);    	
-    }
-    
-    /**
-     * Shut down service waiting for work to complete.
-     * Essential services will also be shutdown.
-     */
-    private void shutdownService(ServiceID serviceID, boolean now) {
-        logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0042, serviceID));
-
-        ServiceRegistryBinding serviceBinding = null;
-        try {
-			serviceBinding = this.registry.getServiceBinding(serviceID.getHostName(), serviceID.getVMControllerID().toString(), serviceID);
-        } catch (ResourceNotBoundException e) {
-            throw new ServiceException(e, PlatformPlugin.Util.getString(LogMessageKeys.VM_0043, serviceID));
-        }
-
-        validateServiceID(serviceID);
-
-        // if service is not running then don't try to stop.
-        if (serviceBinding.getService() != null && serviceBinding.getCurrentState() != ServiceState.STATE_INIT_FAILED) {
-            stopService(serviceBinding, now, true);
-        }
-
-        try {
-            events.serviceRemoved(serviceID);
-        } catch (Exception e) {
-            throw new ServiceException(e, PlatformPlugin.Util.getString(LogMessageKeys.VM_0044, serviceID));
-        }
-    }
-
-    /**
      * Set the current log configuration for this vm.
      */
     public void setCurrentLogConfiguration(LogConfiguration logConfiguration) {
@@ -760,14 +652,6 @@
     }
 
     /**
-     * Run GC on vm.
-     */
-    public void runGC() {
-        logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0005));
-        System.gc();
-    }
-
-    /**
      * Private helper method that verifies service belongs to this vm
      */
     private void validateServiceID(ServiceID serviceID) {
@@ -959,6 +843,9 @@
         if (shutdown) {
         	events.serviceRemoved(binding.getServiceID());
         }
+        else {
+        	events.serviceUpdated(binding);
+        }
     }
     
     

Modified: trunk/server/src/main/java/com/metamatrix/server/HostController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/HostController.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/server/HostController.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -363,10 +363,7 @@
 	            if (vm.getHostName().equalsIgnoreCase(this.host.getFullName())) {
 	                if (vm.getVMName().equalsIgnoreCase(vmName)) {
 	                    try {
-	                    	if (stopNow)
-	                    		vm.getVMController().shutdownNow();
-	                    	else
-	                    		vm.getVMController().shutdown();
+                    		vm.getVMController().shutdown(stopNow);
 	                    } catch (Exception e) {
 	                        // ignore
 	                    }

Modified: trunk/server/src/main/java/com/metamatrix/server/Main.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/Main.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/server/Main.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -114,7 +114,7 @@
             Runtime.getRuntime().addShutdownHook(new ShutdownWork());
             
             // start the VM
-            this.vmController.startVM();
+            this.vmController.start();
             
             synchronized (this.vmController) {
                 while(!this.vmController.isShuttingDown()) {

Modified: trunk/server/src/main/java/com/metamatrix/server/ServiceManager.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/server/ServiceManager.java	2009-03-03 23:05:42 UTC (rev 534)
+++ trunk/server/src/main/java/com/metamatrix/server/ServiceManager.java	2009-03-03 23:23:06 UTC (rev 535)
@@ -32,9 +32,6 @@
 import java.util.Map;
 import java.util.Properties;
 
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
 import com.google.inject.Guice;
 import com.google.inject.Inject;
 import com.google.inject.Injector;
@@ -89,15 +86,11 @@
     private final static int COMMAND_LIST_VM_PROPERTIES      = 12;
     private final static int COMMAND_LIST_SERVICE_PROPERTIES = 13;
     private final static int COMMAND_SHUTDOWN_SERVER         = 14;
-    private final static int COMMAND_SHUTDOWN_SERVICE        = 15;
-    private final static int COMMAND_SHUTDOWN_SERVICE_NOW    = 16;
     private final static int COMMAND_SHUTDOWN_VM             = 17;
-    private final static int COMMAND_SHUTDOWN_VM_NOW         = 18;
     private final static int COMMAND_START_SERVICE           = 19;
     private final static int COMMAND_EXPERT_MODE_ON          = 20;
     private final static int COMMAND_EXPERT_MODE_OFF         = 21;
     private final static int COMMAND_GET_SERVICE_QUEUES      = 22;
-    private final static int COMMAND_RUN_GC                  = 23;
     private final static int COMMAND_GET_VM_STATS            = 24;
     private final static int COMMAND_DUMP_THREADS            = 25;
     private final static int COMMAND_SYNCH_SERVER            = 26;
@@ -106,7 +99,6 @@
     private final static int COMMAND_BOUNCE_SERVICE          = 29;
     private final static int COMMAND_CLEAR_CODE_TABLE_CACHES = 30;
     private final static int COMMAND_CLEAR_PREPARED_STMT_CACHES = 31;
-    private final static int COMMAND_DUMP_JNDI				 = 32;
     private final static int COMMAND_EXIT                    = 33;
     private final static int COMMAND_HELP                    = 34;
     private final static int COMMAND_INVALID                 = 35;
@@ -127,15 +119,11 @@
                                               "ListProcessProps", //$NON-NLS-1$
                                               "ListServiceProps", //$NON-NLS-1$
                                               "ShutdownServer", //$NON-NLS-1$
-                                              "ShutdownService", //$NON-NLS-1$
-                                              "ShutdownServiceNow", //$NON-NLS-1$
                                               "ShutdownProcess", //$NON-NLS-1$
-                                              "ShutdownProcessNow", //$NON-NLS-1$
                                               "RestartService", //$NON-NLS-1$
                                               "ExpertModeOn", //$NON-NLS-1$
                                               "ExpertModeOff", //$NON-NLS-1$
                                               "GetServiceQueues", //$NON-NLS-1$
-                                              "RunGC", //$NON-NLS-1$
                                               "GetProcessStats", //$NON-NLS-1$
                                               "DumpThreads", //$NON-NLS-1$
                                               "Synch", //$NON-NLS-1$
@@ -144,7 +132,6 @@
 											  "BounceService", //$NON-NLS-1$
 											  "ClearCodeTableCaches", //$NON-NLS-1$
 											  "ClearPreparedStatementCaches", //$NON-NLS-1$
-											  "DumpJNDI", //$NON-NLS-1$
                                               "Exit", //$NON-NLS-1$
                                               "Help" }; //$NON-NLS-1$
 
@@ -163,15 +150,11 @@
                                                    "ListProcessProps", //$NON-NLS-1$
                                                    "ListServiceProps", //$NON-NLS-1$
                                                    "ShutdownServer", //$NON-NLS-1$
-                                                   "ShutdownService", //$NON-NLS-1$
-                                                   "ShutdownServiceNow", //$NON-NLS-1$
                                                    "ShutdownProcess", //$NON-NLS-1$
-                                                   "ShutdownProcessNow", //$NON-NLS-1$
                                                    "RestartService", //$NON-NLS-1$
                                                    "ExpertModeOn", //$NON-NLS-1$
                                                    "ExpertModeOff", //$NON-NLS-1$
                                                    "GetServiceQueues", //$NON-NLS-1$
-                                                   "RunGC", //$NON-NLS-1$
                                                    "GetProcessStats", //$NON-NLS-1$
                                                    "DumpThreads", //$NON-NLS-1$
                                                    "Synch", //$NON-NLS-1$
@@ -180,7 +163,6 @@
 												   "BounceService", //$NON-NLS-1$
 											  	   "ClearCodeTableCaches", //$NON-NLS-1$
 											       "ClearPreparedStatementCaches", //$NON-NLS-1$
- 												   "DumpJNDI", //$NON-NLS-1$
                                                    "Exit", //$NON-NLS-1$
                                                    "Help" }; //$NON-NLS-1$
 
@@ -433,31 +415,6 @@
                 }
                 break;
 
-            case COMMAND_SHUTDOWN_VM_NOW:
-                if (numTokens < 2) {
-                    System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0013));
-                } else {
-                    String vmName = (String) parsedCommand.get(1);
-                    doShutdownVM(vmName, true);
-                }
-                break;
-
-            case COMMAND_SHUTDOWN_SERVICE:
-                if (numTokens < 2) {
-                    System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0015));
-                } else {
-                    String id = (String) parsedCommand.get(1);
-                    long value;
-                    try {
-                        value = Long.parseLong(id);
-                    } catch (Exception e) {
-                        System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0016));
-                        break;
-                    }
-                    doShutdownService(new ServiceID(value, null), false);
-                }
-                break;
-
             case COMMAND_BOUNCE_SERVICE:
                 if (numTokens < 2) {
                     System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0031));
@@ -471,22 +428,6 @@
                 doShutdownServer();
                 break;
 
-            case COMMAND_SHUTDOWN_SERVICE_NOW:
-                if (numTokens < 2) {
-                    System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0015));
-                } else {
-                    String id = (String) parsedCommand.get(1);
-                    long value;
-                    try {
-                        value = Long.parseLong(id);
-                    } catch (Exception e) {
-                        System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0016));
-                        break;
-                    }
-                    doShutdownService(new ServiceID(value, null), true);
-                }
-                break;
-
             case COMMAND_EXPERT_MODE_ON:
                 this.expertMode = true;
                 printUsage();
@@ -497,15 +438,6 @@
                 printUsage();
                 break;
 
-            case COMMAND_RUN_GC:
-                if (numTokens < 2) {
-                    System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0013));
-                } else {
-                    String vmName = (String) parsedCommand.get(1);
-                    doRunGC(vmName);
-                }
-                break;
-
             case COMMAND_GET_VM_STATS:
                 if (numTokens < 2) {
                     System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0013));
@@ -569,10 +501,6 @@
 				doClearPreparedStatementCaches();
                 break;
 
-            case COMMAND_DUMP_JNDI:
-				doDumpJNDI();
-                break;
-
             case COMMAND_START_SERVICE:
                 if (numTokens < 2) {
                     System.out.println(PlatformPlugin.Util.getString(LogMessageKeys.SERVICE_0015));
@@ -591,15 +519,6 @@
         }
     }
 
-	private void doDumpJNDI() {
-		try {
-			Context ctx = new InitialContext();
-			System.out.println("JDNI:"); //$NON-NLS-1$
-			System.out.println(ctx.list("")); //$NON-NLS-1$
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
 
 	public void doBounceService(String name) {
 
@@ -788,20 +707,6 @@
 		}
     }
 
-    private void doRunGC(String vmName) {
-        VMControllerInterface vm = getVMController(vmName);
-        if (vm != null) {
-            try {
-                vm.runGC();
-            } catch (Exception e) {
-                System.out.println(PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0029, vmName));
-                e.printStackTrace();
-            }
-        } else {
-            System.out.println(PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0030, vmName));
-        }
-    }
-
     private void doGetVMStats(String vmName) {
         VMControllerInterface vm = getVMController(vmName);
         if (vm != null) {
@@ -844,7 +749,7 @@
             Iterator vmIter = registry.getVMs(null).iterator();
             while (vmIter.hasNext()) {
                 VMRegistryBinding vmBinding = (VMRegistryBinding) vmIter.next();
-                if (vmBinding.getVMController().getName().equalsIgnoreCase(vmName)) {
+                if (vmBinding.getVMName().equalsIgnoreCase(vmName)) {
                     return vmBinding.getVMController();
                 }
             }
@@ -976,8 +881,7 @@
             VMRegistryBinding vmBinding = null;
             while (vmIter.hasNext()) {
                 vmBinding = (VMRegistryBinding) vmIter.next();
-                if (vmBinding.getVMController().getName().equalsIgnoreCase(vmName)) {
-                    vmBinding.getVMController().stopVM();
+                if (vmBinding.getVMName().equalsIgnoreCase(vmName)) {
                     this.hostManager.killServer(vmBinding.getHostName(),vmBinding.getVMName(), false);
                     break;
                 }
@@ -1019,19 +923,12 @@
     }
 
     public void doShutdownVM(String vmName, boolean now) {
-
-        // find vm
         try {
             Iterator vmIter = registry.getVMs(null).iterator();
             while (vmIter.hasNext()) {
                 VMRegistryBinding vmBinding = (VMRegistryBinding) vmIter.next();
-                if (vmBinding.getVMController().getName().equalsIgnoreCase(vmName)) {
-                    if (now) {
-                        vmBinding.getVMController().shutdownNow();
-                    } else {
-                        vmBinding.getVMController().shutdown();
-                    }
-                    this.hostManager.killServer(vmBinding.getHostName(), vmName, false);
+                if (vmBinding.getVMName().equalsIgnoreCase(vmName)) {
+                    this.hostManager.killServer(vmBinding.getHostName(), vmName, now);
                     return;
                 }
             }
@@ -1145,7 +1042,7 @@
             }
             VMRegistryBinding vmBinding = registry.getVM(id.getHostName(), id.getVMControllerID().toString());
             if (vmBinding != null) {
-            	vmBinding.getVMController().stopService(id);
+            	vmBinding.getVMController().stopService(id, false, false);
             }
             else {
             	System.out.println("No VM found on host="+id.getHostName()+" with id="+id.getVMControllerID().toString()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1156,33 +1053,6 @@
         }
     }
 
-    public void doShutdownService(ServiceID serviceID, boolean now) {
-
-        ServiceID id = null;
-        try {
-            id = getServiceID(serviceID);
-            if (id == null) {
-                System.out.println(PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0039));
-                return;
-            }
-            VMRegistryBinding vmBinding = registry.getVM(id.getHostName(), id.getVMControllerID().toString());
-            if (vmBinding != null) {
-                if (now) {
-                	vmBinding.getVMController().shutdownServiceNow(id);
-                } else {
-                	vmBinding.getVMController().shutdownService(id);
-                }
-            }
-            else {
-            	System.out.println("No VM found on host="+id.getHostName()+" with id="+id.getVMControllerID().toString());//$NON-NLS-1$ //$NON-NLS-2$
-            }
-            
-        } catch (Exception e) {
-            System.out.println(PlatformPlugin.Util.getString(ErrorMessageKeys.SERVICE_0015, id));
-            e.printStackTrace();
-        }
-    }
-
     public void doShutdownAllHCs() {
     	System.out.println("Cluster is being shutdown"); //$NON-NLS-1$
     	try {




More information about the teiid-commits mailing list