question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cache SelectorProvider is not suitable for NioServerSocketChannel

See original GitHub issue

I found the issue https://github.com/netty/netty/issues/2308 saying that calling SelectorProvider#provider for every new channel creation causes performance problems,So the SelectorProvider is cached. But cache SelectorProvider is not suitable for NioServerSocketChannel, because NioServerSocketChannel will only be created once, it will not be created many times like NioSocketChannel, caching SelectorProvider in NioServerSocketChannel is instead a memory consumption.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
normanmaurercommented, Oct 13, 2019

Also an application may create multiple server channels

Am 13.10.2019 um 15:01 schrieb Johno Crawford notifications@github.com:

How does it cause unnecessary memory overhead when it is a static field?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

0reactions
normanmaurercommented, Oct 14, 2019

I agree with @johnou . Lets keep the code as it is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.nio.channels.spi.SelectorProvider Example - Program Talk
public NioSocketChannel(SelectorProvider provider) { this(newSocket(provider)); } ... close the channel if the key is not valid anymore unsafe.close(unsafe.
Read more >
SelectorProvider (Java SE 18 & JDK 18) - Oracle Help Center
A selector provider is a concrete subclass of this class that has a zero-argument constructor and implements the abstract methods specified below.
Read more >
A Tour of Netty. Introduction | by Kondah Mouad | Geek Culture
This article serves as a valuable introduction to master I/O related technologies, it spans all of aspects needed to be on your way...
Read more >
Java NIO - Quick Guide - Tutorialspoint
But this is not possible in case of conventional java IO as no multi ... Java NIO server socket channel is again a...
Read more >
Java Examples for io.netty.channel.socket.DatagramChannel
private static DatagramChannel newSocket(SelectorProvider provider) { try ... server.channel(NioServerSocketChannel.class).group(m_tcpEventLoop).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found