@EventListener @SuppressWarnings("UnusedParameters") public void onClearCache(ClearCacheEvent event) { refreshAll(); }
@Override public void doUpgrade(final boolean setupMode) throws Exception { dbConnectionManager.execute(dbConnection -> { dbConnection.setAutoCommit(false); List<Long> propertyIds = getMinusOneUserLocalePropertyIds(dbConnection); if (!propertyIds.isEmpty()) { LOG.debug("Removing {} user locale preferences with value -1", propertyIds.size()); List<List<Long>> batches = Lists.partition(propertyIds, MAX_ROWS_IN_BATCH); for (int i = 0; i < batches.size(); i++) { LOG.debug("Deleting batch {} of {}", i + 1, batches.size()); deleteMinusOneUserLocaleProperty(batches.get(i), dbConnection); } } dbConnection.commit(); }); OfBizPropertyEntryStore entryStore = ComponentAccessor.getComponent(OfBizPropertyEntryStore.class); if (entryStore instanceof CachingOfBizPropertyEntryStore) { ((CachingOfBizPropertyEntryStore)entryStore).refreshAll(); } }
void globalRefresh(boolean quickImport) { if (quickImport) { log.warn("QuickImport is on, doing a fast refresh."); final PluginPersistentStateStore pluginPersistentStateStore = ComponentAccessor.getComponentOfType(PluginPersistentStateStore.class); // We need to keep track of which plugins were disabled in the old instance of JIRA, before we clear the cache final PluginPersistentState oldState = pluginPersistentStateStore.load(); // Lets be tricky and clear the CachingOfBizPropertyEntryStore first since so much depends on these // through ApplicationProperties(that internally use it to cache its entries) and since caches // depend on it (e.g. DefaultServiceManager) (LEGO-866) ComponentAccessor.getComponentOfType(CachingOfBizPropertyEntryStore.class).refreshAll(); // Clear the state out of JIRA ComponentAccessor.getComponentOfType(EventPublisher.class).publish(ClearCacheEvent.INSTANCE); // We need to call enable/disable on the plugins which states have changed because of the newly imported data syncPluginStateWithNewData(pluginPersistentStateStore, oldState); } else { ManagerFactory.globalRefresh(); } }