AsyncIndexUpdate implements Runnable, Closeable { public static String checkValidName(String asyncName){ checkNotNull(asyncName, "async name should not be null"); if (IndexConstants.ASYNC_REINDEX_VALUE.equals(asyncName)){ return asyncName; } checkArgument(asyncName.endsWith("async"), "async name [%s] does not confirm to " + "naming pattern of ending with 'async'", asyncName); return asyncName; } AsyncIndexUpdate(@NotNull String name, @NotNull NodeStore store,
                            @NotNull IndexEditorProvider provider, boolean switchOnSync);  AsyncIndexUpdate(@NotNull String name, @NotNull NodeStore store,
                            @NotNull IndexEditorProvider provider, StatisticsProvider statsProvider, boolean switchOnSync);  AsyncIndexUpdate(@NotNull String name, @NotNull NodeStore store,
                            @NotNull IndexEditorProvider provider); static String checkValidName(String asyncName); static boolean isAsyncLaneName(String asyncName); @Override synchronized void run(); @Override void close(); static String leasify(String name); void setValidatorProviders(List<ValidatorProvider> validatorProviders); void setCorruptIndexHandler(TrackingCorruptIndexHandler corruptIndexHandler); boolean isClosed(); AsyncIndexStats getIndexStats(); boolean isFinished(); boolean isFailing(); void setIndexMBeanRegistration(IndexMBeanRegistration mbeanRegistration); String getName(); static final String PROP_ASYNC_NAME; }
@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){ } }