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
ADocumentProcessor
that processesNodeState
s.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AsyncNodeStateProcessor.NodeStateTask
-
Field Summary
Fields Modifier and Type Field Description protected RevisionVector
headRevision
protected DocumentNodeStore
ns
protected NodeState
uuidIndex
-
Constructor Summary
Constructors Modifier Constructor Description protected
AsyncNodeStateProcessor(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 NodeState
getNodeByUUID(@NotNull String uuid, @NotNull AtomicReference<String> resolvedPath)
Utility method that resolves heuuid
into aNodeState
with the help of the UUID index.protected boolean
process(NodeDocument doc)
Decide early whether aNodeDocument
should be processed or not.protected abstract void
runTask(@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 aNodeDocument
should be processed or not. This implementation returnstrue
if 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 heuuid
into aNodeState
with the help of the UUID index.- Parameters:
uuid
- the UUID to resolve.resolvedPath
- will be set to the resolved path if available.- Returns:
- the
NodeState
with the given UUID ornull
if 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:
createTask
in 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 theNodeState
to process.state
- theNodeState
ornull
if 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.
-
-