@Override public String abortAndPause() { //First pause to avoid any race pause(); //Set the forcedStop flag anyway. In resume this would be cleared forcedStopFlag.set(true); String msg = ""; //Abort if any indexing run is in progress if (runPermit.availablePermits() == 0){ msg = "Abort request placed for current run. "; } return msg + "Indexing is paused now. Invoke 'resume' to resume indexing"; }
@Override public String abortAndPause() { //First pause to avoid any race pause(); //Set the forcedStop flag anyway. In resume this would be cleared forcedStopFlag.set(true); String msg = ""; //Abort if any indexing run is in progress if (runPermit.availablePermits() == 0){ msg = "Abort request placed for current run. "; } return msg + "Indexing is paused now. Invoke 'resume' to resume indexing"; }
@Override public String abortAndPause() { //First pause to avoid any race pause(); //Set the forcedStop flag anyway. In resume this would be cleared forcedStopFlag.set(true); String msg = ""; //Abort if any indexing run is in progress if (runPermit.availablePermits() == 0){ msg = "Abort request placed for current run. "; } return msg + "Indexing is paused now. Invoke 'resume' to resume indexing"; }
@Test public void testAsyncPause() throws Exception { NodeStore store = new MemoryNodeStore(); IndexEditorProvider provider = new PropertyIndexEditorProvider(); NodeBuilder builder = store.getRoot().builder(); createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "rootIndex", true, false, ImmutableSet.of("foo"), null) .setProperty(ASYNC_PROPERTY_NAME, "async"); builder.child("testRoot").setProperty("foo", "abc"); // merge it back in store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY); AsyncIndexUpdate async = new AsyncIndexUpdate("async", store, provider); async.getIndexStats().pause(); async.run(); assertFalse(store.getRoot().getChildNode(INDEX_DEFINITIONS_NAME) .getChildNode("rootIndex") .hasChildNode(INDEX_CONTENT_NODE_NAME)); async.getIndexStats().resume(); async.run(); NodeState root = store.getRoot(); // first check that the index content nodes exist checkPathExists(root, INDEX_DEFINITIONS_NAME, "rootIndex", INDEX_CONTENT_NODE_NAME); assertFalse(root.getChildNode(INDEX_DEFINITIONS_NAME).hasChildNode( ":conflict")); PropertyIndexLookup lookup = new PropertyIndexLookup(root); assertEquals(ImmutableSet.of("testRoot"), find(lookup, "foo", "abc")); }