-
Couldn't load subscription status.
- Fork 81
properly name netty threads #511
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3b374e6
properly name netty threads
jsvd 29e81ef
properly name netty threads
jsvd 7b92e06
Update the Java unit tests which use the interface changed Server class.
mashhurs c599a2a
Fix rspec errors.
mashhurs d147217
Merge pull request #1 from mashhurs/naming-threads
jsvd 4e712bb
Update VERSION
jsvd 7a48a47
Update CHANGELOG.md
jsvd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,14 @@ | |
| import org.apache.logging.log4j.Logger; | ||
| import org.logstash.netty.SslHandlerProvider; | ||
|
|
||
| import static org.logstash.beats.util.DaemonThreadFactory.daemonThreadFactory; | ||
|
|
||
| public class Server { | ||
| private final static Logger logger = LogManager.getLogger(Server.class); | ||
|
|
||
| private final int port; | ||
|
|
||
| private final String id; | ||
| private final String host; | ||
| private final int eventLoopThreadCount; | ||
| private final int executorThreadCount; | ||
|
|
@@ -33,7 +37,8 @@ public class Server { | |
|
|
||
| private final int clientInactivityTimeoutSeconds; | ||
|
|
||
| public Server(String host, int port, int clientInactivityTimeoutSeconds, int eventLoopThreadCount, int executorThreadCount) { | ||
| public Server(String id, String host, int port, int clientInactivityTimeoutSeconds, int eventLoopThreadCount, int executorThreadCount) { | ||
| this.id = id; | ||
| this.host = host; | ||
| this.port = port; | ||
| this.clientInactivityTimeoutSeconds = clientInactivityTimeoutSeconds; | ||
|
|
@@ -54,12 +59,12 @@ public Server listen() throws InterruptedException { | |
| logger.error("Could not shut down worker group before starting", e); | ||
| } | ||
| } | ||
| bossGroup = new NioEventLoopGroup(eventLoopThreadCount); // TODO: add a config to make it adjustable, no need many threads | ||
| workGroup = new NioEventLoopGroup(eventLoopThreadCount); | ||
| bossGroup = new NioEventLoopGroup(eventLoopThreadCount, daemonThreadFactory(id + "-bossGroup")); // TODO: add a config to make it adjustable, no need many threads | ||
| workGroup = new NioEventLoopGroup(eventLoopThreadCount, daemonThreadFactory(id + "-workGroup")); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, this is helpful for investigation.
|
||
| try { | ||
| logger.info("Starting server on port: {}", this.port); | ||
|
|
||
| beatsInitializer = new BeatsInitializer(messageListener, clientInactivityTimeoutSeconds, executorThreadCount); | ||
| beatsInitializer = new BeatsInitializer(id, messageListener, clientInactivityTimeoutSeconds, executorThreadCount); | ||
|
|
||
| ServerBootstrap server = new ServerBootstrap(); | ||
| server.group(bossGroup, workGroup) | ||
|
|
@@ -143,12 +148,14 @@ private class BeatsInitializer extends ChannelInitializer<SocketChannel> { | |
| private final IMessageListener localMessageListener; | ||
| private final int localClientInactivityTimeoutSeconds; | ||
|
|
||
| BeatsInitializer(IMessageListener messageListener, int clientInactivityTimeoutSeconds, int beatsHandlerThread) { | ||
| BeatsInitializer(String pluginId, IMessageListener messageListener, int clientInactivityTimeoutSeconds, int beatsHandlerThreadCount) { | ||
| // Keeps a local copy of Server settings, so they can't be modified once it starts listening | ||
| this.localMessageListener = messageListener; | ||
| this.localClientInactivityTimeoutSeconds = clientInactivityTimeoutSeconds; | ||
| idleExecutorGroup = new DefaultEventExecutorGroup(DEFAULT_IDLESTATEHANDLER_THREAD); | ||
| beatsHandlerExecutorGroup = new DefaultEventExecutorGroup(beatsHandlerThread); | ||
| idleExecutorGroup = new DefaultEventExecutorGroup(DEFAULT_IDLESTATEHANDLER_THREAD, | ||
| daemonThreadFactory(pluginId + "-idleStateHandler")); | ||
| beatsHandlerExecutorGroup = new DefaultEventExecutorGroup(beatsHandlerThreadCount, | ||
| daemonThreadFactory(pluginId + "-beatsHandler")); | ||
| } | ||
|
|
||
| public void initChannel(SocketChannel socket) { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.