@Override public void clear(Portlet portlet, boolean resetRemotePortletBag) { String rootPortletId = portlet.getRootPortletId(); Map<String, InvokerPortlet> portletInstances = _pool.remove(rootPortletId); if (portletInstances != null) { InvokerPortlet rootInvokerPortletInstance = portletInstances.remove(rootPortletId); if (rootInvokerPortletInstance != null) { rootInvokerPortletInstance.destroy(); } portletInstances.clear(); } PortletApp portletApp = portlet.getPortletApp(); if (resetRemotePortletBag && portletApp.isWARFile()) { PortletBag portletBag = PortletBagPool.remove(rootPortletId); if (portletBag != null) { portletBag.destroy(); } } }
@Override public void removedService( ServiceReference<Portlet> serviceReference, com.liferay.portal.model.Portlet portletModel) { portletModel.unsetReady(); ServiceRegistrations serviceRegistrations = _serviceRegistrations.get(serviceReference.getBundle()); if (serviceRegistrations == null) { return; } BundlePortletApp bundlePortletApp = serviceRegistrations.getBundlePortletApp(); bundlePortletApp.removePortlet(portletModel); serviceRegistrations.removeServiceReference(serviceReference); BundleContext bundleContext = _componentContext.getBundleContext(); bundleContext.ungetService(serviceReference); _portletInstanceFactory.destroy(portletModel); List<Company> companies = _companyLocalService.getCompanies(); for (Company company : companies) { PortletCategory portletCategory = (PortletCategory) WebAppPool.get(company.getCompanyId(), WebKeys.PORTLET_CATEGORY); portletCategory.separate(portletModel.getRootPortletId()); } PortletBag portletBag = PortletBagPool.remove(portletModel.getRootPortletId()); if (portletBag != null) { portletBag.destroy(); } }