Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio servlet: don't change map while used by interation #801

Merged
merged 1 commit into from
May 7, 2019
Merged

audio servlet: don't change map while used by interation #801

merged 1 commit into from
May 7, 2019

Conversation

maggu2810
Copy link
Contributor

We should not remove entries (so keys) from the map while we are using the key set (a view) of that map (see JavaDoc: otherwise "results of the iteration undefined").

We should not remove entries (so keys) from the map while we are using
the key set (a view) of that map (see JavaDoc: otherwise "results of the
iteration undefined").

Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
Copy link
Contributor

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

// the stream has expired, we need to remove it!
final FixedLengthAudioStream stream = multiTimeStreams.remove(streamId);
streamTimeouts.remove(streamId);
IOUtils.closeQuietly(stream);
Copy link
Contributor

Choose a reason for hiding this comment

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

@maggu2810 I think in this line you can find a piece of the puzzle to answer #532.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really. While reading this implementation there are much more things that confused me. I answered to #532

@cweitkamp cweitkamp merged commit d19ee33 into openhab:master May 7, 2019
@maggu2810 maggu2810 deleted the audioservlet-removetimeoutstreams branch May 7, 2019 19:52
@wborn wborn added this to the 2.5 milestone Jul 30, 2019
Rosi2143 pushed a commit to Rosi2143/openhab-core that referenced this pull request Dec 26, 2020
Signed-off-by: Patrick Fink <mail@pfink.de>
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 11, 2023
…nhab#801)

We should not remove entries (so keys) from the map while we are using
the key set (a view) of that map (see JavaDoc: otherwise "results of the
iteration undefined").

Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
GitOrigin-RevId: d19ee33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants