Class HealthChecker
Checks various aspects of the application to verify that they are functioning correctly:
- Source I/O
- When an image endpoint successfully completes a request, it calls
addSourceUsage(Source)
to register the source it used to do so. This class tests the I/O of each unique source. - The variant cache
- An image is written to the variant cache (if available) and read back.
- The info cache
- An info is written to the info cache (if available) and read back.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addSourceUsage
(Source source) Informs the class of aSource
that has just been used successfully, and could be used again in the course of a health check.Performs a health check as explained in the class documentation.Performs a health check as explained in the class documentation.static Set
<SourceUsage> For testing only!static void
overrideHealth
(Health health) For testing only!
-
Constructor Details
-
HealthChecker
public HealthChecker()
-
-
Method Details
-
addSourceUsage
-
getSourceUsages
For testing only! -
overrideHealth
For testing only!- Parameters:
health
- Custom instance that will be returned bycheckSerially()
. Supplynull
to clear the override.
-
checkSerially
Performs a health check as explained in the class documentation. Each group of checks (variant cache, source I/O, etc.) is performed sequentially. If any check fails, all remaining checks are skipped.
N.B.: it may be faster to
do all of the checks concurrently
; but this could also result in having to do more checks than necessary, since, if a single check fails, none of the others matter.- Returns:
- Instance reflecting the application health.
- See Also:
-
checkConcurrently
Performs a health check as explained in the class documentation. Each group of checks (variant cache, source I/O, etc.) is performed concurrently. This may cause the check to complete faster than the one via
checkSerially()
but it also may result in performing more checks than necessary.- Returns:
- Instance reflecting the application health.
- See Also:
-