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

[Wisp] Thread-based asynchronous IO implementation #57

Closed

Conversation

joeyleeeeeee97
Copy link
Contributor

Summary:
Use ThreadPool as asynchronous IO delegate for asynchronous IO implementation.
The feature can be used in Wisp flow and non-Wisp flow.

Test Plan: test/com/alibaba/wisp/io/ThreadPoolAIOTest.java

Reviewed-by: leiyu, zhengxiaolinX

Issue: dragonwell-project/dragonwell8#213

@CLAassistant
Copy link

CLAassistant commented Mar 17, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@zhengxiaolinX zhengxiaolinX 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 to me.

@@ -486,7 +517,17 @@ public int skipBytes(int n) throws IOException {
* @exception IOException if an I/O error occurs.
*/
public void write(int b) throws IOException {
write0(b);
if (WispAsyncIO.useAsyncIO()) {
sun.misc.SharedSecrets.getWispAsyncIOAccess().executeAsyncIO(new Callable<Integer>() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can remove the sun.misc.? Will look more ordered.

Runtime.getRuntime().availableProcessors());
MAX_POOL_SIZE = parsePositiveIntegerParameter(p, "com.alibaba.aio.maxPoolSize",
Runtime.getRuntime().availableProcessors());
AIO_QUEUE_LIMIT = parsePositiveIntegerParameter(p, "com.alibaba.aio.queueLimit", -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder about the magic number. I think we'd better use a named variable to represent the -1 and reference it here. Or if the -1 changes afterwards, we may get to change several places all together.

MAX_POOL_SIZE = parsePositiveIntegerParameter(p, "com.alibaba.aio.maxPoolSize",
Runtime.getRuntime().availableProcessors());
AIO_QUEUE_LIMIT = parsePositiveIntegerParameter(p, "com.alibaba.aio.queueLimit", -1);
TIMEOUT = parsePositiveIntegerParameter(p, "com.alibaba.aio.timeout", -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

also this, and all hard coded -1 places

Summary:
Use ThreadPool as asynchronous IO delegate for asynchronous IO implementation.
The feature can be used in Wisp flow and non-Wisp flow.

Test Plan: test/com/alibaba/wisp/io/ThreadPoolAIOTest.java

Reviewed-by: leiyu, zhengxiaolinX

Issue:  dragonwell-project/dragonwell8#213

thread local judge
@joeyleeeeeee97
Copy link
Contributor Author

Not necessay now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants