Author: theute
Date: 2011-04-14 02:17:30 -0400 (Thu, 14 Apr 2011)
New Revision: 6212
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
Log:
OOM Issue when starting up with many pages
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-04-13
19:59:57 UTC (rev 6211)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-04-14
06:17:30 UTC (rev 6212)
@@ -20,7 +20,9 @@
package org.exoplatform.portal.config;
import org.exoplatform.commons.utils.IOUtil;
+import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.BaseComponentPlugin;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.ValueParam;
@@ -134,33 +136,48 @@
public void run() throws Exception
{
- if (dataStorage_.getPortalConfig(defaultPortal) != null)
- return;
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
+ {
+ if (dataStorage_.getPortalConfig(defaultPortal) != null)
+ return;
+ }
+ finally
+ {
+ RequestLifeCycle.end();
+ }
if (isUseTryCatch)
{
-
- for (NewPortalConfig ele : configs)
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
{
- try
+ for (NewPortalConfig ele : configs)
{
- initPortletPreferencesDB(ele);
+ try
+ {
+ initPortletPreferencesDB(ele);
+ }
+ catch (Exception e)
+ {
+ log.error("NewPortalConfig error: " + e.getMessage(), e);
+ }
}
- catch (Exception e)
+ for (NewPortalConfig ele : configs)
{
- log.error("NewPortalConfig error: " + e.getMessage(), e);
+ try
+ {
+ initPortalConfigDB(ele);
+ }
+ catch (Exception e)
+ {
+ log.error("NewPortalConfig error: " + e.getMessage(), e);
+ }
}
}
- for (NewPortalConfig ele : configs)
+ finally
{
- try
- {
- initPortalConfigDB(ele);
- }
- catch (Exception e)
- {
- log.error("NewPortalConfig error: " + e.getMessage(), e);
- }
+ RequestLifeCycle.end();
}
for (NewPortalConfig ele : configs)
{
@@ -173,17 +190,25 @@
log.error("NewPortalConfig error: " + e.getMessage(), e);
}
}
- for (NewPortalConfig ele : configs)
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
{
- try
+ for (NewPortalConfig ele : configs)
{
- initPageNavigationDB(ele);
+ try
+ {
+ initPageNavigationDB(ele);
+ }
+ catch (Exception e)
+ {
+ log.error("NewPortalConfig error: " + e.getMessage(), e);
+ }
}
- catch (Exception e)
- {
- log.error("NewPortalConfig error: " + e.getMessage(), e);
- }
}
+ finally
+ {
+ RequestLifeCycle.end();
+ }
for (NewPortalConfig ele : configs)
{
try
@@ -199,22 +224,38 @@
}
else
{
- for (NewPortalConfig ele : configs)
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
{
- initPortletPreferencesDB(ele);
+ for (NewPortalConfig ele : configs)
+ {
+ initPortletPreferencesDB(ele);
+ }
+ for (NewPortalConfig ele : configs)
+ {
+ initPortalConfigDB(ele);
+ }
}
- for (NewPortalConfig ele : configs)
+ finally
{
- initPortalConfigDB(ele);
+ RequestLifeCycle.end();
}
for (NewPortalConfig ele : configs)
{
initPageDB(ele);
}
- for (NewPortalConfig ele : configs)
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
{
- initPageNavigationDB(ele);
+ for (NewPortalConfig ele : configs)
+ {
+ initPageNavigationDB(ele);
+ }
}
+ finally
+ {
+ RequestLifeCycle.end();
+ }
for (NewPortalConfig ele : configs)
{
ele.getPredefinedOwner().clear();
@@ -374,8 +415,15 @@
ArrayList<Page> list = pageSet.getPages();
for (Page page : list)
{
- dataStorage_.create(page);
- pomMgr.getSession().save();
+ RequestLifeCycle.begin(PortalContainer.getInstance());
+ try
+ {
+ dataStorage_.create(page);
+ }
+ finally
+ {
+ RequestLifeCycle.end();
+ }
}
}
@@ -390,13 +438,11 @@
if (currentNavigation == null)
{
dataStorage_.create(navigation);
-// pomMgr.getSession().save();
}
else
{
navigation.merge(currentNavigation);
dataStorage_.save(navigation);
- pomMgr.getSession().save();
}
}
@@ -411,7 +457,6 @@
for (PortletPreferences portlet : list)
{
dataStorage_.save(portlet);
- pomMgr.getSession().save();
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-04-13
19:59:57 UTC (rev 6211)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-04-14
06:17:30 UTC (rev 6212)
@@ -646,19 +646,12 @@
}
//
- RequestLifeCycle.begin(PortalContainer.getInstance());
-
newPortalConfigListener_.run();
}
catch (Exception e)
{
log.error("Could not import initial data", e);
-
}
- finally
- {
- RequestLifeCycle.end();
- }
}
public void stop()