-
Notifications
You must be signed in to change notification settings - Fork 892
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
Add shortcut methods that create event loops and blocking task executor thread pool #3602
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3602 +/- ##
============================================
+ Coverage 73.00% 73.80% +0.79%
- Complexity 10880 14387 +3507
============================================
Files 947 1263 +316
Lines 41936 54938 +13002
Branches 5207 7026 +1819
============================================
+ Hits 30616 40546 +9930
- Misses 8662 10804 +2142
- Partials 2658 3588 +930
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! @kezhenxu94
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some documentation comments 👍
* Sets the worker {@link EventLoopGroup} which is responsible for performing socket I/O and running | ||
* {@link Client#execute(ClientRequestContext, Request)}. | ||
* If not set, {@linkplain CommonPools#workerGroup() the common worker group} is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this:
Uses a newly created {@link EventLoopGroup} with the specified number of threads for
performing socket I/O and running ...
If not set...
could be removed.
* Sets the worker {@link EventLoopGroup} which is responsible for performing socket I/O and running | ||
* {@link Service#serve(ServiceRequestContext, Request)}. | ||
* If not set, {@linkplain CommonPools#workerGroup() the common worker group} is used. | ||
* The worker {@link EventLoopGroup} will be shut down when the {@link Server} stops. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
@@ -94,7 +93,7 @@ | |||
@BeforeAll | |||
static void beforeAll() { | |||
// use different eventLoop from server's so that clients don't hang when the eventLoop in server hangs | |||
clientFactory = ClientFactory.builder().workerGroup(EventLoopGroups.newEventLoopGroup(2), true).build(); | |||
clientFactory = ClientFactory.builder().workerGroup(2).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up! 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for quick turn-around, @kezhenxu94
@minwoox Gentle ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@kezhenxu94 I've just realized you didn't add |
Added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once @ikhoon's comment is addressed. 😄
Co-authored-by: Ikhun Um <ih.pert@gmail.com>
Please squash when merging 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…or thread pool (line#3602) Motivation: It may be useful if a user can create a new event loop or blocking task executor that has the same life cycle with a `ClientFactory` or `Server`: ```java ClientFactory .builder() .workerGroup(3) .build() Server .builder() .workerGroup(3) .blockingTaskExecutor(10) ... .build() ``` Modifications: - Added `ClientFactoryBuilder.workerGroup(int)` - Added `ServerBuilder.workerGroup(int)` - Added `ServerBuilder.blockingTaskExecutor(int)` Result: - Closes line#3597
Motivation:
It may be useful if a user can create a new event loop or blocking task executor that has the same life cycle with a
ClientFactory
orServer
:Modifications:
ClientFactoryBuilder.workerGroup(int)
ServerBuilder.workerGroup(int)
ServerBuilder.blockingTaskExecutor(int)
Result: