@EventListener public static void onApplicationPropertyChange(ApplicationPropertyChangeEvent event) { try { Map params = event.getParams(); ApplicationPropertyMetadata metadata = (ApplicationPropertyMetadata) params.get(ApplicationPropertyChangeEvent.KEY_METADATA); if (APKeys.JIRA_PROJECTKEY_PATTERN.equals(metadata.getKey())) { log.info("Resetting the issue key matcher"); JiraKeyUtils.resetKeyMatcher(); } } catch (Exception e) { log.error("Unable to decide whether to reset the project key matcher because the event doesn't seem to contain the correct metadata"); } } }
private static void clearStatics() { ComponentAccessor.initialiseWorker(null); DefaultOfBizConnectionFactory.getInstance().resetInstance(); JiraAuthenticationContextImpl.clearRequestCache(); while (RequestCacheController.isInContext()) { RequestCacheController.closeContext(); } DefaultIndexManager.flushThreadLocalSearchers(); JiraKeyUtils.resetKeyMatcher(); try { final Field field = Configuration.class.getDeclaredField("configurationImpl"); field.setAccessible(true); field.set(Configuration.class, null); } catch (NoSuchFieldException e) { throw new AssertionError(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } }