/** * Schedules a periodic task based on schedulePeriodForDiskLimitCheck to * update store and temporary store limits if the amount of available space * plus current store size is less than the existin configured limit */ protected void scheduleDiskUsageLimitsCheck() throws IOException { if (schedulePeriodForDiskUsageCheck > 0 && (getPersistenceAdapter() != null || getTmpDataDirectory() != null)) { Runnable diskLimitCheckTask = new Runnable() { @Override public void run() { try { checkStoreUsageLimits(); } catch (Throwable e) { LOG.error("Failed to check persistent disk usage limits", e); } try { checkTmpStoreUsageLimits(); } catch (Throwable e) { LOG.error("Failed to check temporary store usage limits", e); } } }; scheduler.executePeriodically(diskLimitCheckTask, schedulePeriodForDiskUsageCheck); } }
/** * @return the tempDataStore */ public synchronized PListStore getTempDataStore() { if (tempDataStore == null && !hasStartException()) { if (!isPersistent()) { return null; } try { PersistenceAdapter pa = getPersistenceAdapter(); if( pa!=null && pa instanceof PListStore) { return (PListStore) pa; } } catch (IOException e) { throw new RuntimeException(e); } try { String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl"; this.tempDataStore = (PListStore) getClass().getClassLoader().loadClass(clazz).newInstance(); this.tempDataStore.setDirectory(getTmpDataDirectory()); configureService(tempDataStore); } catch (ClassNotFoundException e) { throw new RuntimeException("Kahadb class PListStoreImpl not found. Add activemq-kahadb jar or set persistent to false on BrokerService.", e); } catch (Exception e) { throw new RuntimeException(e); } } return tempDataStore; }
File tmpDir = brokerService.getTmpDataDirectory(); if (tmpDir != null) {
/** * Check that temporary usage limit is not greater than max usable * space and adjust if it is */ protected void checkTmpStoreUsageLimits() throws Exception { final SystemUsage usage = getSystemUsage(); File tmpDir = getTmpDataDirectory(); if (tmpDir != null) { checkUsageLimit(tmpDir, usage.getTempUsage(), usage.getTempUsage().getPercentLimit()); if (isPersistent()) { long maxJournalFileSize; PListStore store = usage.getTempUsage().getStore(); if (store != null && store instanceof JournaledStore) { maxJournalFileSize = ((JournaledStore) store).getJournalMaxFileLength(); } else { maxJournalFileSize = DEFAULT_MAX_FILE_LENGTH; } long storeLimit = usage.getTempUsage().getLimit(); if (storeLimit > 0 && storeLimit < maxJournalFileSize) { LOG.error("Temporary Store limit is " + storeLimit / (1024 * 1024) + " mb, whilst the max journal file size for the temporary store is: " + maxJournalFileSize / (1024 * 1024) + " mb, " + "the temp store will not accept any data when used."); } } } }
boolean empty = true; try { File directory = getTmpDataDirectory(); if (directory.exists() && directory.isDirectory()) { File[] files = directory.listFiles(); this.tempDataStore.setDirectory(getTmpDataDirectory()); this.tempDataStore.start(); } catch (Exception e) {
/** * @return the tempDataStore */ public synchronized PListStore getTempDataStore() { if (tempDataStore == null) { if (!isPersistent()) { return null; } try { PersistenceAdapter pa = getPersistenceAdapter(); if( pa!=null && pa instanceof PListStore) { return (PListStore) pa; } } catch (IOException e) { throw new RuntimeException(e); } try { String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl"; this.tempDataStore = (PListStore) getClass().getClassLoader().loadClass(clazz).newInstance(); this.tempDataStore.setDirectory(getTmpDataDirectory()); configureService(tempDataStore); } catch (ClassNotFoundException e) { throw new RuntimeException("Kahadb class PListStoreImpl not found. Add activemq-kahadb jar or set persistent to false on BrokerService.", e); } catch (Exception e) { throw new RuntimeException(e); } } return tempDataStore; }
/** * @return the tempDataStore */ public synchronized PListStore getTempDataStore() { if (tempDataStore == null) { if (!isPersistent()) { return null; } try { PersistenceAdapter pa = getPersistenceAdapter(); if( pa!=null && pa instanceof PListStore) { return (PListStore) pa; } } catch (IOException e) { throw new RuntimeException(e); } try { String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl"; this.tempDataStore = (PListStore) getClass().getClassLoader().loadClass(clazz).newInstance(); this.tempDataStore.setDirectory(getTmpDataDirectory()); configureService(tempDataStore); } catch (ClassNotFoundException e) { throw new RuntimeException("Kahadb class PListStoreImpl not found. Add activemq-kahadb jar or set persistent to false on BrokerService.", e); } catch (Exception e) { throw new RuntimeException(e); } } return tempDataStore; }
/** * @return the tempDataStore */ public synchronized PListStore getTempDataStore() { if (tempDataStore == null) { if (!isPersistent()) { return null; } try { PersistenceAdapter pa = getPersistenceAdapter(); if( pa!=null && pa instanceof PListStore) { return (PListStore) pa; } } catch (IOException e) { throw new RuntimeException(e); } try { String clazz = "org.apache.activemq.store.kahadb.plist.PListStoreImpl"; this.tempDataStore = (PListStore) getClass().getClassLoader().loadClass(clazz).newInstance(); this.tempDataStore.setDirectory(getTmpDataDirectory()); configureService(tempDataStore); } catch (ClassNotFoundException e) { throw new RuntimeException("Kahadb class PListStoreImpl not found. Add activemq-kahadb jar or set persistent to false on BrokerService.", e); } catch (Exception e) { throw new RuntimeException(e); } } return tempDataStore; }
/** * Schedules a periodic task based on schedulePeriodForDiskLimitCheck to * update store and temporary store limits if the amount of available space * plus current store size is less than the existin configured limit */ protected void scheduleDiskUsageLimitsCheck() throws IOException { if (schedulePeriodForDiskUsageCheck > 0 && (getPersistenceAdapter() != null || getTmpDataDirectory() != null)) { Runnable diskLimitCheckTask = new Runnable() { @Override public void run() { try { checkStoreUsageLimits(); } catch (Exception e) { LOG.error("Failed to check persistent disk usage limits", e); } try { checkTmpStoreUsageLimits(); } catch (Exception e) { LOG.error("Failed to check temporary store usage limits", e); } } }; scheduler.executePeriodically(diskLimitCheckTask, schedulePeriodForDiskUsageCheck); } }
/** * Schedules a periodic task based on schedulePeriodForDiskLimitCheck to * update store and temporary store limits if the amount of available space * plus current store size is less than the existin configured limit */ protected void scheduleDiskUsageLimitsCheck() throws IOException { if (schedulePeriodForDiskUsageCheck > 0 && (getPersistenceAdapter() != null || getTmpDataDirectory() != null)) { Runnable diskLimitCheckTask = new Runnable() { @Override public void run() { try { checkStoreUsageLimits(); } catch (Exception e) { LOG.error("Failed to check persistent disk usage limits", e); } try { checkTmpStoreUsageLimits(); } catch (Exception e) { LOG.error("Failed to check temporary store usage limits", e); } } }; scheduler.executePeriodically(diskLimitCheckTask, schedulePeriodForDiskUsageCheck); } }
/** * Schedules a periodic task based on schedulePeriodForDiskLimitCheck to * update store and temporary store limits if the amount of available space * plus current store size is less than the existin configured limit */ protected void scheduleDiskUsageLimitsCheck() throws IOException { if (schedulePeriodForDiskUsageCheck > 0 && (getPersistenceAdapter() != null || getTmpDataDirectory() != null)) { Runnable diskLimitCheckTask = new Runnable() { @Override public void run() { try { checkStoreUsageLimits(); } catch (Exception e) { LOG.error("Failed to check persistent disk usage limits", e); } try { checkTmpStoreUsageLimits(); } catch (Exception e) { LOG.error("Failed to check temporary store usage limits", e); } } }; scheduler.executePeriodically(diskLimitCheckTask, schedulePeriodForDiskUsageCheck); } }
File tmpDir = brokerService.getTmpDataDirectory(); if (tmpDir != null) {
File tmpDir = brokerService.getTmpDataDirectory(); if (tmpDir != null) {
File tmpDir = brokerService.getTmpDataDirectory(); if (tmpDir != null) {
/** * Check that temporary usage limit is not greater than max usable * space and adjust if it is */ protected void checkTmpStoreUsageLimits() throws Exception { final SystemUsage usage = getSystemUsage(); File tmpDir = getTmpDataDirectory(); if (tmpDir != null) { checkUsageLimit(tmpDir, usage.getTempUsage(), usage.getTempUsage().getPercentLimit()); if (isPersistent()) { long maxJournalFileSize; PListStore store = usage.getTempUsage().getStore(); if (store != null && store instanceof JournaledStore) { maxJournalFileSize = ((JournaledStore) store).getJournalMaxFileLength(); } else { maxJournalFileSize = DEFAULT_MAX_FILE_LENGTH; } long storeLimit = usage.getTempUsage().getLimit(); if (storeLimit > 0 && storeLimit < maxJournalFileSize) { LOG.error("Temporary Store limit is " + storeLimit / (1024 * 1024) + " mb, whilst the max journal file size for the temporary store is: " + maxJournalFileSize / (1024 * 1024) + " mb, " + "the temp store will not accept any data when used."); } } } }
/** * Check that temporary usage limit is not greater than max usable * space and adjust if it is */ protected void checkTmpStoreUsageLimits() throws Exception { final SystemUsage usage = getSystemUsage(); File tmpDir = getTmpDataDirectory(); if (tmpDir != null) { checkUsageLimit(tmpDir, usage.getTempUsage(), usage.getTempUsage().getPercentLimit()); if (isPersistent()) { long maxJournalFileSize; PListStore store = usage.getTempUsage().getStore(); if (store != null && store instanceof JournaledStore) { maxJournalFileSize = ((JournaledStore) store).getJournalMaxFileLength(); } else { maxJournalFileSize = DEFAULT_MAX_FILE_LENGTH; } long storeLimit = usage.getTempUsage().getLimit(); if (storeLimit > 0 && storeLimit < maxJournalFileSize) { LOG.error("Temporary Store limit is " + storeLimit / (1024 * 1024) + " mb, whilst the max journal file size for the temporary store is: " + maxJournalFileSize / (1024 * 1024) + " mb, " + "the temp store will not accept any data when used."); } } } }
/** * Check that temporary usage limit is not greater than max usable * space and adjust if it is */ protected void checkTmpStoreUsageLimits() throws Exception { final SystemUsage usage = getSystemUsage(); File tmpDir = getTmpDataDirectory(); if (tmpDir != null) { checkUsageLimit(tmpDir, usage.getTempUsage(), usage.getTempUsage().getPercentLimit()); if (isPersistent()) { long maxJournalFileSize; PListStore store = usage.getTempUsage().getStore(); if (store != null && store instanceof JournaledStore) { maxJournalFileSize = ((JournaledStore) store).getJournalMaxFileLength(); } else { maxJournalFileSize = DEFAULT_MAX_FILE_LENGTH; } long storeLimit = usage.getTempUsage().getLimit(); if (storeLimit > 0 && storeLimit < maxJournalFileSize) { LOG.error("Temporary Store limit is " + storeLimit / (1024 * 1024) + " mb, whilst the max journal file size for the temporary store is: " + maxJournalFileSize / (1024 * 1024) + " mb, " + "the temp store will not accept any data when used."); } } } }