Object
Report
- Enclosing interface:
ErrorHandler
Information about errors that occurred while reading or writing tiles in an image.
A single
Report may be generated for failures in more than one tiles.
Multi-threading
This class is safe for use in multi-threading. The synchronization lock isthis.
However, the LogRecord instance returned by getDescription() is not thread-safe.
Operations applied on the LogRecord should be inside a block synchronized on the
Report.this lock.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(Point tile, Throwable error, Supplier<LogRecord> record) Reports an error that occurred while computing an image tile.Returns a description of the first error as a log record.Point[]Returns indices of all tiles where an error has been reported.booleanisEmpty()Returnstrueif no error has been reported.
-
Constructor Details
-
Report
public Report()Creates an initially empty report. Error reports can be added by calls toadd(…).
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returnstrueif no error has been reported. This is true only if theadd(…)method has never been invoked.- Returns:
- whether this report is empty.
-
add
Reports an error that occurred while computing an image tile. This method can be invoked many times on the sameReportinstance.Logging information
Reportcreates aLogRecordthe first time that thisadd(…)method is invoked. The log record is created using the given supplier if non-null. That supplier should set the log level, message, source class name, source method name and logger name. The exception property will be set by this method.- Parameters:
tile- column (x) and row (y) indices of the tile where the error occurred, ornullif unknown.error- the error that occurred.record- the record supplier, invoked only when this method is invoked for the first time. Ifnull, a defaultLogRecordwill be created.- Returns:
trueif this is the first time that an error is reported (in which case aLogRecordinstance has been created), orfalseif aLogRecordalready exists.
-
getTileIndices
Returns indices of all tiles where an error has been reported.- Returns:
- indices of all tiles in error, or an empty array if none.
-
getDescription
Returns a description of the first error as a log record. The exception can be obtained byLogRecord.getThrown(). If more than one error occurred, the other errors are reported as suppressed exceptions. The return value is never null unless this report is empty.- Returns:
- errors description, or
nullif this report is empty.
-