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

[Misc] Resource Management API #8

Merged
merged 1 commit into from
Mar 13, 2020
Merged

[Misc] Resource Management API #8

merged 1 commit into from
Mar 13, 2020

Conversation

yuleil
Copy link
Contributor

@yuleil yuleil commented Mar 11, 2020

Summary:
Introduce ResourceContainer to manage resources.
ResourceContainer defines a set of resource Constraint
that limit resource usage by threads.

Test Plan: jtreg com/alibaba/rcm

Reviewed-by: luchsh sanhong

Issue: dragonwell-project/dragonwell8#87

@CLAassistant
Copy link

CLAassistant commented Mar 11, 2020

CLA assistant check
All committers have signed the CLA.

@yuleil yuleil self-assigned this Mar 11, 2020
@yuleil yuleil requested review from luchsh and kuaiwei March 11, 2020 02:53
return ROOT;
}

public static AbstractResourceContainer current() {
Copy link
Contributor

Choose a reason for hiding this comment

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

current() == null looks like undefined behavior, we'd better return non-null value, either ROOT or current

if (!VM.isBooted()) {
   return root();
}
return JLA.getResourceContainer(Thread.currentThread());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍
It's a good idea to ensure that Thread.resourceContainer is always not null. 😋

* with {@link ResourceContainer#current()}
*/
protected void detach() {
JLA.setResourceContainer(Thread.currentThread(), null);
Copy link
Contributor

Choose a reason for hiding this comment

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

JLA.setResourceContainer(Thread.currentThread(), root())

Summary:
Introduce ResourceContainer to manage resources.
ResourceContainer defines a set of resource Constraint
that limit resource usage by threads.

Test Plan: jtreg com/alibaba/rcm

Reviewed-by: luchsh, sanhong

Issue: dragonwell-project/dragonwell8#87
Copy link
Contributor

@luchsh luchsh left a comment

Choose a reason for hiding this comment

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

looks good

@yuleil yuleil merged commit 76ecee1 into dragonwell-project:master Mar 13, 2020
@yuleil yuleil deleted the rcm branch March 13, 2020 09:44
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.

4 participants