コード例 #1
0
  private static void _reloadServletContext(
      HttpServletRequest request, UnicodeProperties unicodeProperties) throws Exception {

    // Data sources

    Properties jdbcProperties = new Properties();

    jdbcProperties.putAll(unicodeProperties);

    jdbcProperties = PropertiesUtil.getProperties(jdbcProperties, "jdbc.default.", true);

    DataSourceSwapper.swapCounterDataSource(jdbcProperties);
    DataSourceSwapper.swapLiferayDataSource(jdbcProperties);

    // Caches

    CacheRegistryUtil.clear();
    MultiVMPoolUtil.clear();
    WebCachePoolUtil.clear();
    CentralizedThreadLocal.clearShortLivedThreadLocals();

    // Persistence beans

    _reconfigurePersistenceBeans();

    // Quartz

    QuartzLocalServiceUtil.checkQuartzTables();

    // Startup

    StartupAction startupAction = new StartupAction();

    startupAction.run(null);

    // Servlet context

    HttpSession session = request.getSession();

    PortalInstances.reload(session.getServletContext());
  }
コード例 #2
0
  public static void upgrade() throws Exception {

    // Disable database caching before upgrade

    if (_log.isDebugEnabled()) {
      _log.debug("Disable cache registry");
    }

    CacheRegistryUtil.setActive(false);

    // Check release

    int buildNumber = ReleaseLocalServiceUtil.getBuildNumberOrCreate();

    if (buildNumber > ReleaseInfo.getParentBuildNumber()) {
      StringBundler sb = new StringBundler(6);

      sb.append("Attempting to deploy an older Liferay Portal version. ");
      sb.append("Current build version is ");
      sb.append(buildNumber);
      sb.append(" and attempting to deploy version ");
      sb.append(ReleaseInfo.getParentBuildNumber());
      sb.append(".");

      throw new IllegalStateException(sb.toString());
    } else if (buildNumber < ReleaseInfo.RELEASE_5_2_3_BUILD_NUMBER) {
      String msg = "You must first upgrade to Liferay Portal 5.2.3";

      System.out.println(msg);

      throw new RuntimeException(msg);
    }

    // Reload SQL

    CustomSQLUtil.reloadCustomSQL();
    SQLTransformer.reloadSQLTransformer();

    // Upgrade

    if (_log.isDebugEnabled()) {
      _log.debug("Update build " + buildNumber);
    }

    _checkPermissionAlgorithm();
    _checkReleaseState();

    if (PropsValues.UPGRADE_DATABASE_TRANSACTIONS_DISABLED) {
      _disableTransactions();
    }

    try {
      StartupHelperUtil.upgradeProcess(buildNumber);
    } catch (Exception e) {
      _updateReleaseState(ReleaseConstants.STATE_UPGRADE_FAILURE);

      throw e;
    } finally {
      if (PropsValues.UPGRADE_DATABASE_TRANSACTIONS_DISABLED) {
        _enableTransactions();
      }
    }

    // Update company key

    if (StartupHelperUtil.isUpgraded()) {
      if (_log.isDebugEnabled()) {
        _log.debug("Update company key");
      }

      _updateCompanyKey();
    }

    // Check class names

    if (_log.isDebugEnabled()) {
      _log.debug("Check class names");
    }

    ClassNameLocalServiceUtil.checkClassNames();

    // Check resource actions

    if (_log.isDebugEnabled()) {
      _log.debug("Check resource actions");
    }

    ResourceActionLocalServiceUtil.checkResourceActions();

    // Delete temporary images

    if (_log.isDebugEnabled()) {
      _log.debug("Delete temporary images");
    }

    _deleteTempImages();

    // Clear the caches only if the upgrade process was run

    if (_log.isDebugEnabled()) {
      _log.debug("Clear cache if upgrade process was run");
    }

    if (StartupHelperUtil.isUpgraded()) {
      MultiVMPoolUtil.clear();
    }
  }
コード例 #3
0
 protected void cacheMulti() throws Exception {
   MultiVMPoolUtil.clear();
 }