Better thread-handling and cleanup in PDFBoxDocument #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improved PDFBoxDocument by removing the need for synchronized methods:
getNumberOfPagesandisLandscapedelivered pre-computed informationrenderPagewill be the only method that accesses the PDDocument. It is always called from the service, thus no multi-threading problemsclosewill only be called once, sosynchronizedwas never really needed here.It also fixed the (minor) resource leak in
com.dlsc.pdfviewfx.PDFBoxDocument.getSearchResults(String)by closing the PDDocument created for searching.It does not fix the (minor) resource leak in
com.dlsc.pdfviewfx.PDFBoxDocument.getPageable(), this should / will be handled as Issue #30.It also removes the need to work around the initialisation problems found in Issue #25. Since there are no synchronized methods anymore, the Mac JDK will no longer hang. Thus the PR also removes the workaround.
It also includes some minor cleanup (unneeded imports removed)