private AsyncConfig(String name, long timeIntervalInSecs) { this.name = AsyncIndexUpdate.checkValidName(name); this.timeIntervalInSecs = timeIntervalInSecs; }
private AsyncConfig(String name, long timeIntervalInSecs) { this.name = AsyncIndexUpdate.checkValidName(name); this.timeIntervalInSecs = timeIntervalInSecs; }
private AsyncConfig(String name, long timeIntervalInSecs) { this.name = AsyncIndexUpdate.checkValidName(name); this.timeIntervalInSecs = timeIntervalInSecs; }
/** * <p> * Enable the asynchronous (background) indexing behavior for the provided * task name. * </p> * <p> * Please note that when enabling the background indexer, you need to take * care of calling * <code>#shutdown</code> on the <code>executor</code> provided for this Oak instance. * </p> */ public Oak withAsyncIndexing(@NotNull String name, long delayInSeconds) { if (this.asyncTasks == null) { asyncTasks = new HashMap<String, Long>(); } checkState(delayInSeconds > 0, "delayInSeconds value must be > 0"); asyncTasks.put(AsyncIndexUpdate.checkValidName(name), delayInSeconds); return this; }
/** * <p> * Enable the asynchronous (background) indexing behavior for the provided * task name. * </p> * <p> * Please note that when enabling the background indexer, you need to take * care of calling * <code>#shutdown</code> on the <code>executor</code> provided for this Oak instance. * </p> */ public Oak withAsyncIndexing(@Nonnull String name, long delayInSeconds) { if (this.asyncTasks == null) { asyncTasks = new HashMap<String, Long>(); } checkState(delayInSeconds > 0, "delayInSeconds value must be > 0"); asyncTasks.put(AsyncIndexUpdate.checkValidName(name), delayInSeconds); return this; }
/** * <p> * Enable the asynchronous (background) indexing behavior for the provided * task name. * </p> * <p> * Please note that when enabling the background indexer, you need to take * care of calling * <code>#shutdown</code> on the <code>executor</code> provided for this Oak instance. * </p> */ public Oak withAsyncIndexing(@NotNull String name, long delayInSeconds) { if (this.asyncTasks == null) { asyncTasks = new HashMap<String, Long>(); } checkState(delayInSeconds > 0, "delayInSeconds value must be > 0"); asyncTasks.put(AsyncIndexUpdate.checkValidName(name), delayInSeconds); return this; }
public AsyncIndexUpdate(@Nonnull String name, @Nonnull NodeStore store, @Nonnull IndexEditorProvider provider, StatisticsProvider statsProvider, boolean switchOnSync) { this.name = checkValidName(name); this.lastIndexedTo = lastIndexedTo(name); this.store = checkNotNull(store); this.provider = checkNotNull(provider); this.switchOnSync = switchOnSync; this.leaseTimeOut = DEFAULT_ASYNC_TIMEOUT; this.statisticsProvider = statsProvider; this.indexStats = new AsyncIndexStats(name, statsProvider); }
public AsyncIndexUpdate(@NotNull String name, @NotNull NodeStore store, @NotNull IndexEditorProvider provider, StatisticsProvider statsProvider, boolean switchOnSync) { this.name = checkValidName(name); this.lastIndexedTo = lastIndexedTo(name); this.store = checkNotNull(store); this.provider = checkNotNull(provider); this.switchOnSync = switchOnSync; this.leaseTimeOut = DEFAULT_ASYNC_TIMEOUT; this.statisticsProvider = statsProvider; this.indexStats = new AsyncIndexStats(name, statsProvider); this.corruptIndexHandler.setMeterStats(statsProvider.getMeter(TrackingCorruptIndexHandler.CORRUPT_INDEX_METER_NAME, StatsOptions.METRICS_ONLY)); }
public AsyncIndexUpdate(@NotNull String name, @NotNull NodeStore store, @NotNull IndexEditorProvider provider, StatisticsProvider statsProvider, boolean switchOnSync) { this.name = checkValidName(name); this.lastIndexedTo = lastIndexedTo(name); this.store = checkNotNull(store); this.provider = checkNotNull(provider); this.switchOnSync = switchOnSync; this.leaseTimeOut = DEFAULT_ASYNC_TIMEOUT; this.statisticsProvider = statsProvider; this.indexStats = new AsyncIndexStats(name, statsProvider); this.corruptIndexHandler.setMeterStats(statsProvider.getMeter("corrupt-index", StatsOptions.METRICS_ONLY)); }
@Test public void validName() throws Exception{ assertNotNull(AsyncIndexUpdate.checkValidName("async")); assertNotNull(AsyncIndexUpdate.checkValidName("foo-async")); assertNotNull(AsyncIndexUpdate.checkValidName(IndexConstants.ASYNC_REINDEX_VALUE)); try{ AsyncIndexUpdate.checkValidName(null); fail(); } catch (Exception ignore){ } try{ AsyncIndexUpdate.checkValidName("foo"); fail(); } catch (Exception ignore){ } }