sum.undeploy(name, targetDir.getAbsolutePath());
ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(component.getComponent().getClass().getClassLoader()); sum.undeploy(name, targetDir.getAbsolutePath()); } finally { Thread.currentThread().setContextClassLoader(cl); }
    protected void undeployServiceUnit(ServiceUnitLifeCycle su) throws DeploymentException {        String name = su.getName();        String componentName = su.getComponentName();        File targetDir = su.getServiceUnitRootPath();        registry.unregisterServiceUnit(su.getKey());        // unpack the artifact        // now get the component and give it a SA        ComponentMBeanImpl component = container.getComponent(componentName);        if (component != null) {            ServiceUnitManager sum = component.getServiceUnitManager();            if (sum != null) {                sum.undeploy(name, targetDir.getAbsolutePath());                FileUtil.deleteFile(targetDir);            }        }        else {            FileUtil.deleteFile(targetDir);        }        log.info("UnDeployed ServiceUnit " + name + " from Component: " + componentName);    }