Skip to content

Conversation

askoog
Copy link

@askoog askoog commented Jan 13, 2021

Finding deadlocked threads might be an expensive operation if there are
a large number of threads in the jvm since it requires a safepoint.

Finding deadlocked threads might be an expensive operation if there are
a large number of threads in the jvm since it requires a safepoint.
Finding deadlocked threads might be an expensive operation if there are
a large number of threads in the jvm since it requires a safepoint.

Signed-off-by: Andreas Skoog <[email protected]>
[email protected]:askoog/client_java.git into
optional-deadlocked-threads-metric

Signed-off-by: Andreas Skoog <[email protected]>
@askoog askoog force-pushed the optional-deadlocked-threads-metric branch from ffa9616 to 1afba44 Compare January 13, 2021 12:58
Copy link
Contributor

@brian-brazil brian-brazil left a comment

Choose a reason for hiding this comment

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

How would the user access the object to call this?

*/
public class ThreadExports extends Collector {
private final ThreadMXBean threadBean;
private boolean includeDeadlockedThreads = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs locking.

Copy link
Author

Choose a reason for hiding this comment

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

Locking in what way? Better to set it in overloaded constructor?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's one option, this can be accessed and mutated concurrently which is the issue. You could also split this out to a completely separate collector.

@askoog
Copy link
Author

askoog commented Jan 13, 2021

How would the user access the object to call this?

I suppose you need to do instantiate the ThreadExports class directly, instead of just calling DefaultExports.register()?

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.

2 participants