@Override
    public void run() {
      for (UpgradeInfo upgradeInfo : _upgradeInfos) {
        UpgradeStep upgradeStep = upgradeInfo.getUpgradeStep();

        try {
          upgradeStep.upgrade(
              new DBProcessContext() {

                @Override
                public DBContext getDBContext() {
                  return new DBContext();
                }

                @Override
                public OutputStream getOutputStream() {
                  return _outputStream;
                }
              });

          _releaseLocalService.updateRelease(
              _bundleSymbolicName,
              upgradeInfo.getToSchemaVersionString(),
              upgradeInfo.getFromSchemaVersionString());
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }

      CacheRegistryUtil.clear();
    }
  /**
   * Clears the cache for all tickets.
   *
   * <p>The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link
   * com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
   */
  @Override
  public void clearCache() {
    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
      CacheRegistryUtil.clear(TicketImpl.class.getName());
    }

    EntityCacheUtil.clearCache(TicketImpl.class.getName());
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
  }
  /**
   * Clears the cache for all projects entries.
   *
   * <p>The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link
   * com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
   */
  @Override
  public void clearCache() {
    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
      CacheRegistryUtil.clear(ProjectsEntryImpl.class.getName());
    }

    EntityCacheUtil.clearCache(ProjectsEntryImpl.class);

    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
  }
Ejemplo n.º 4
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());
  }
 protected void cacheDb() throws Exception {
   CacheRegistryUtil.clear();
 }