Hi everyone,
Since no one has answered this question I think it is time for me to write
down what I have found and what I ended up with.
I found out that I need to use DefaultEventLoop, which I have already known
earlier.
Now I found out that I can not reach the thread there (maybe it is possible
with reflection, but other than that ..), but the class gives you the
threadstate.
I thought that I should be counting threads with RUNNABLE and BLOCKED
states so I ended up with something like below.
Any suggestions on this solution and the question would be appreciated :)
Iterator<EventExecutor> iterator = xxx.getEventLoopGroup().iterator();
while (iterator.hasNext()) {
DefaultEventLoop eventExecutor = (DefaultEventLoop) iterator.next();
pendingCount += eventExecutor.pendingTasks();
if (eventExecutor.threadProperties().state() == Thread.State.RUNNABLE ||
eventExecutor.threadProperties().state() == Thread.State.BLOCKED)
activeCount++;
}
On Saturday, October 6, 2018 at 3:45:14 AM UTC+3, Aykut wrote:
>
> Hi all,
>
> I am trying to port a multichannel application to Netty 4, which is
> currently working with Netty 3.
>
> In the current setup with Netty 3, when I add my main handler to the
> pipeline I am using the OrderedMemoryAwareThreadPoolExecutor.
>
> By this threadpool executor, I can monitor the current active threads,
> tasks in queue etc, so that I can understand when there is a lock or a
> heavy job that makes the system wait.
>
> Now when I try to port to Netty 4, There is no
> OrderedMemoryAwareThreadPoolExecutor.
>
> People say that I should use DefaultEventLoopGroup (with number of
> threads) instead which is not suitable for me as I can not get the active
> threads from DefaultEventLoopGroup etc.
>
> So, to solve the problem I checked for a Multithreaded executor and I saw
> the UnorderedThreadPoolEventExecutor, but this has no ordering of channel
> events.
> I will also need the ordering that OrderedMemoryAwareThreadPoolExecutor
> provided.
>
> So how can I run a netty handler with a threadpool executor that also has
> the ordering ?
>
> Thanks in advance
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/netty/d283dd6d-5a4c-4069-baee-41448de97bec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.