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

#369 Daemonize threads #646

Merged
merged 4 commits into from
Apr 18, 2018
Merged

#369 Daemonize threads #646

merged 4 commits into from
Apr 18, 2018

Conversation

bsideup
Copy link
Member

@bsideup bsideup commented Apr 17, 2018

No description provided.

@bsideup bsideup added this to the next milestone Apr 17, 2018
compile 'org.rnorth.visible-assertions:visible-assertions:2.1.0'

shaded ('com.github.docker-java:docker-java:3.0.12') {
shaded ('com.github.docker-java:docker-java:3.1.0-rc-2') {
Copy link
Member Author

Choose a reason for hiding this comment

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

it's fine to use rc-2 here because we're shading it anyway. The changes from 3.0.x doesn't seem to break anything

Copy link
Member

Choose a reason for hiding this comment

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

Seems OK, but let's migrate to a non-rc version as soon as we can.

@@ -0,0 +1,304 @@
package org.testcontainers.dockerclient.transport;
Copy link
Member Author

Choose a reason for hiding this comment

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

check the javadoc for this class. This is almost one-to-one version from docker-java with some modifications.
The whole class to be replaced with another transport (like OkHttp), so I wouldn't bother refactoring it any futher

Copy link
Member

Choose a reason for hiding this comment

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

👍 I'll not review this in too much detail as it's largely based on well-tested principles.


@Test
public void testThatAllThreadsAreDaemons() throws Exception {
ProcessBuilder processBuilder = new ProcessBuilder(
Copy link
Member Author

Choose a reason for hiding this comment

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

we need to fork the JVM, otherwise we might already initialize the threads and the result will not reflect the scenario ("should not create non-daemon threads")

Copy link
Member

Choose a reason for hiding this comment

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

Creative solution 😄

Copy link
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

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

Only some very trivial comments from me - please feel free to merge as-is if you disagree.

DaemonTest.class.getCanonicalName()
);

assert processBuilder.inheritIO().start().waitFor() == 0;
Copy link
Member

Choose a reason for hiding this comment

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

It's not critical, but why not an assertEquals call here?


@Test
public void testThatAllThreadsAreDaemons() throws Exception {
ProcessBuilder processBuilder = new ProcessBuilder(
Copy link
Member

Choose a reason for hiding this comment

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

Creative solution 😄

import java.util.Set;
import java.util.stream.Collectors;

public class DaemonTest {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe worth a comment here to explain why there's a main method, roughly what the test does?
People might jump to conclusions, perhaps!

* Changes:
* - daemonized thread factory
* - thread group
* - the logging handler removed
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean no more log noise from netty?

If so, 😻 x 💯!
Also, it'd be worthy of a mention in the changelog.

Copy link
Member Author

Choose a reason for hiding this comment

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

:D Yes, it does :)
It of course makes logs less debuggable but since not every TC user knows how to configure the logger IMO this is a much better UX

@@ -0,0 +1,304 @@
package org.testcontainers.dockerclient.transport;
Copy link
Member

Choose a reason for hiding this comment

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

👍 I'll not review this in too much detail as it's largely based on well-tested principles.

compile 'org.rnorth.visible-assertions:visible-assertions:2.1.0'

shaded ('com.github.docker-java:docker-java:3.0.12') {
shaded ('com.github.docker-java:docker-java:3.1.0-rc-2') {
Copy link
Member

Choose a reason for hiding this comment

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

Seems OK, but let's migrate to a non-rc version as soon as we can.

@bsideup bsideup merged commit aca9a93 into master Apr 18, 2018
@bsideup bsideup deleted the daemons branch April 18, 2018 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants