brettwooldridge / NuProcess

Low-overhead, non-blocking I/O, external Process implementation for Java
Apache License 2.0
712 stars 84 forks source link

Linux epoll event pool can be created more than once #70

Closed rdicroce closed 7 years ago

rdicroce commented 7 years ago

This is a minor issue I noticed while debugging an unrelated problem.

ProcessEpoll's eventPool is a static field, so it is shared across all instances. But it is populated inside the ProcessEpoll constructor, which can be called more than once, depending on the number of processing threads. The constructor doesn't check if the pool was already created, so it will create a new pool and overwrite the existing one each time it is invoked.

This should be fixed so the event pool will only be created once. The constructor could check if eventPool != null, or the event pool creation could be moved to a static initializer block.

brettwooldridge commented 7 years ago

@rdicroce Thanks for reporting that. Pull requests welcomed. 😄