Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

[ui/Charts] Explicitly close the image output-stream, using a try-with-resources #4380

Merged
merged 1 commit into from Oct 6, 2017
Merged

[ui/Charts] Explicitly close the image output-stream, using a try-with-resources #4380

merged 1 commit into from Oct 6, 2017

Conversation

martinvw
Copy link
Contributor

@martinvw martinvw commented Oct 5, 2017

Folloing the openHAB community topic:

https://community.openhab.org/t/java-io-ioexception-too-many-open-files/28204/10?u=martinvw

The current implementation is depending on:

This class provide means to properly close hanging
image input/output streams on VM shutdown.
This might be useful for proper cleanup such as removal
of temporary files.

Source: https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/com/sun/imageio/stream/StreamCloser.java#L34

The complete stack looks like
ChartServlet.java:280
ImageIO.java:1572
ImageIO.java:419
OutputStreamImageOutputStreamSpi.java:68
FileCacheImageOutputStream.java:95

Signed-off-by: Martin van Wingerden <martinvw@mtin.nl>
@openhab-bot
Copy link
Contributor

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/java-io-ioexception-too-many-open-files/28204/16

@martinvw
Copy link
Contributor Author

martinvw commented Oct 5, 2017

See also this really old bug report which inspired me to solve it like this:

http://bugs.java.com/view_bug.do?bug_id=4894964

@kaikreuzer kaikreuzer added the UI label Oct 5, 2017
Copy link
Contributor

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thanks!

@kaikreuzer kaikreuzer merged commit 002bd4f into eclipse-archived:master Oct 6, 2017
@martinvw martinvw deleted the feature/explicitly-close-image-output-stream branch October 6, 2017 15:23
@openhab-bot
Copy link
Contributor

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/static-conf-html-keeps-files-open/35788/6

@kaikreuzer kaikreuzer added this to the 0.9.0 milestone Nov 30, 2017
@kaikreuzer kaikreuzer added the bug label Dec 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants