@Override public void disableCleanup() { if (!cleanupEnabled) { return; } lock(); try { cleanupEnabled = false; for (PagingStore store : stores.values()) { store.disableCleanup(); } } finally { unlock(); } }
@Override public void resumeCleanup() { if (cleanupEnabled) { return; } lock(); try { cleanupEnabled = true; for (PagingStore store : stores.values()) { store.enableCleanup(); } } finally { unlock(); } }
@Override public synchronized void stop() throws Exception { if (!started) { return; } started = false; if (scheduledComponent != null) { this.scheduledComponent.stop(); this.scheduledComponent = null; } lock(); try { for (PagingStore store : stores.values()) { store.stop(); } pagingStoreFactory.stop(); } finally { unlock(); } }
@Override public void reloadStores() throws Exception { lock(); try { List<PagingStore> reloadedStores = pagingStoreFactory.reloadStores(addressSettingsRepository); for (PagingStore store : reloadedStores) { // when reloading, we need to close the previously loaded version of this // store PagingStore oldStore = stores.remove(store.getStoreName()); if (oldStore != null) { oldStore.stop(); oldStore = null; } store.start(); stores.put(store.getStoreName(), store); } } finally { unlock(); } }
@Override public void start() throws Exception { lock(); try { if (started) { return; } pagingStoreFactory.setPagingManager(this); reloadStores(); if (ARTEMIS_DEBUG_PAGING_INTERVAL > 0) { this.scheduledComponent = new ActiveMQScheduledComponent(pagingStoreFactory.getScheduledExecutor(), pagingStoreFactory.newExecutor(), ARTEMIS_DEBUG_PAGING_INTERVAL, TimeUnit.SECONDS, false) { @Override public void run() { debug(); } }; this.scheduledComponent.start(); } started = true; } finally { unlock(); } }