Class AsyncNodeStateProcessor
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.check.AsyncDocumentProcessor
-
- org.apache.jackrabbit.oak.plugins.document.check.AsyncNodeStateProcessor
-
- All Implemented Interfaces:
DocumentProcessor
- Direct Known Subclasses:
NodeCounter,ReferenceCheck
public abstract class AsyncNodeStateProcessor extends AsyncDocumentProcessor
ADocumentProcessorthat processesNodeStates.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAsyncNodeStateProcessor.NodeStateTask
-
Field Summary
Fields Modifier and Type Field Description protected RevisionVectorheadRevisionprotected DocumentNodeStorensprotected NodeStateuuidIndex
-
Constructor Summary
Constructors Modifier Constructor Description protectedAsyncNodeStateProcessor(DocumentNodeStore ns, RevisionVector headRevision, ExecutorService executorService)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Optional<Callable<Void>>createTask(@NotNull NodeDocument document, @NotNull BlockingQueue<Result> results)protected @Nullable NodeStategetNodeByUUID(@NotNull String uuid, @NotNull AtomicReference<String> resolvedPath)Utility method that resolves heuuidinto aNodeStatewith the help of the UUID index.protected booleanprocess(NodeDocument doc)Decide early whether aNodeDocumentshould be processed or not.protected abstract voidrunTask(@NotNull Path path, @Nullable NodeState state, @NotNull Consumer<Result> resultConsumer)Responsibility of the subclass to implement the processor logic.-
Methods inherited from class org.apache.jackrabbit.oak.plugins.document.check.AsyncDocumentProcessor
processDocument
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.oak.plugins.document.check.DocumentProcessor
end
-
-
-
-
Field Detail
-
ns
protected final DocumentNodeStore ns
-
headRevision
protected final RevisionVector headRevision
-
uuidIndex
protected final NodeState uuidIndex
-
-
Constructor Detail
-
AsyncNodeStateProcessor
protected AsyncNodeStateProcessor(DocumentNodeStore ns, RevisionVector headRevision, ExecutorService executorService)
-
-
Method Detail
-
process
protected boolean process(NodeDocument doc)
Decide early whether aNodeDocumentshould be processed or not. This implementation returnstrueif the document not a split document, otherwisefalse. This method can be overridden by subclasses.- Parameters:
doc- the document to process.- Returns:
- whether the document should be processed or ignored.
-
getNodeByUUID
@Nullable protected final @Nullable NodeState getNodeByUUID(@NotNull @NotNull String uuid, @NotNull @NotNull AtomicReference<String> resolvedPath)
Utility method that resolves heuuidinto aNodeStatewith the help of the UUID index.- Parameters:
uuid- the UUID to resolve.resolvedPath- will be set to the resolved path if available.- Returns:
- the
NodeStatewith the given UUID ornullif it cannot be resolved or doesn't exist.
-
createTask
protected final Optional<Callable<Void>> createTask(@NotNull @NotNull NodeDocument document, @NotNull @NotNull BlockingQueue<Result> results)
- Specified by:
createTaskin classAsyncDocumentProcessor
-
runTask
protected abstract void runTask(@NotNull @NotNull Path path, @Nullable @Nullable NodeState state, @NotNull @NotNull Consumer<Result> resultConsumer)Responsibility of the subclass to implement the processor logic. This method will run as a task with an executor service.- Parameters:
path- the path of theNodeStateto process.state- theNodeStateornullif the node does not exist at this path. This may happen for nodes that have been deleted but not yet garbage collected.resultConsumer- consumes the results of this task.
-
-