Skip to content
Browse files

LPS-25946 Instanceable portlet on removal from page does not clear up…

… InvokerPortlet cache causing memory leak
  • Loading branch information...
1 parent 8f070b5 commit 4500c48af90e3a0806fb8e983754f53c4a54e383 @shuyangzhou shuyangzhou committed with brianchandotcom Mar 7, 2012
View
3 portal-impl/src/com/liferay/portal/model/impl/LayoutTypePortletImpl.java
@@ -59,6 +59,7 @@
import com.liferay.portal.util.PropsUtil;
import com.liferay.portal.util.PropsValues;
import com.liferay.portlet.PortalPreferences;
+import com.liferay.portlet.PortletInstanceFactoryUtil;
import com.liferay.portlet.PortletPreferencesFactoryUtil;
import com.liferay.portlet.sites.util.SitesUtil;
import com.liferay.util.JS;
@@ -941,6 +942,8 @@ public void removePortletId(
return;
}
+ PortletInstanceFactoryUtil.delete(portlet);
+
PermissionChecker permissionChecker =
PermissionThreadLocal.getPermissionChecker();
View
11 portal-impl/src/com/liferay/portlet/PortletInstanceFactoryImpl.java
@@ -182,6 +182,17 @@ public InvokerPortlet create(Portlet portlet, ServletContext servletContext)
return instanceInvokerPortletInstance;
}
+ public void delete(Portlet portlet) {
+ if (PortletConstants.getInstanceId(portlet.getPortletId()) != null) {
+ Map<String, InvokerPortlet> portletInstances = _pool.get(
+ portlet.getRootPortletId());
+
+ if (portletInstances != null) {
+ portletInstances.remove(portlet.getPortletId());
+ }
+ }
+ }
+
public void destroy() {
// LPS-10473
View
2 portal-service/src/com/liferay/portlet/PortletInstanceFactory.java
@@ -32,6 +32,8 @@
public InvokerPortlet create(Portlet portlet, ServletContext servletContext)
throws PortletException;
+ public void delete(Portlet portlet);
+
public void destroy(Portlet portlet);
}
View
4 portal-service/src/com/liferay/portlet/PortletInstanceFactoryUtil.java
@@ -40,6 +40,10 @@ public static InvokerPortlet create(
return getPortletInstanceFactory().create(portlet, servletContext);
}
+ public static void delete(Portlet portlet) {
+ getPortletInstanceFactory().delete(portlet);
+ }
+
public static void destroy(Portlet portlet) {
getPortletInstanceFactory().destroy(portlet);
}

0 comments on commit 4500c48

Please sign in to comment.
Something went wrong with that request. Please try again.