Skip to content

Commit

Permalink
Add customization hook for EventLoopGroup creation #1273
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed May 5, 2020
1 parent 53c6268 commit 83d45aa
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,27 @@ private <T extends EventLoopGroup> T getOrCreate(Class<T> type) {
}

if (!eventLoopGroups.containsKey(type)) {
eventLoopGroups.put(type, createEventLoopGroup(type, numberOfThreads, threadFactoryProvider));
eventLoopGroups.put(type, doCreateEventLoopGroup(type, numberOfThreads, threadFactoryProvider));
}

return (T) eventLoopGroups.get(type);
}

/**
* Customization hook for {@link EventLoopGroup} creation.
*
* @param <T>
* @param type requested event loop group type.
* @param numberOfThreads number of threads to create.
* @param threadFactoryProvider provider for {@link ThreadFactory}.
* @return
* @since 6.0
*/
protected <T extends EventLoopGroup> EventExecutorGroup doCreateEventLoopGroup(Class<T> type, int numberOfThreads,
ThreadFactoryProvider threadFactoryProvider) {
return createEventLoopGroup(type, numberOfThreads, threadFactoryProvider);
}

/**
* Create an instance of a {@link EventExecutorGroup} using the default {@link ThreadFactoryProvider}. Supported types are:
* <ul>
Expand Down

0 comments on commit 83d45aa

Please sign in to comment.