Closed gaspardpetit closed 3 years ago
This would resolve the following issue: https://github.com/t0xa/gelfj/issues/70
With this solution, every new reconnect of the GelfTCPSender.java
will lookup the hostname instead of reuse the cached resolution. Bear in mind that this ends up using the JVM's DNS cache, so it's not an actually lookup every time.
For the GelfUDPSender.java
I had to do it in two places: (1) lookup hostname instead of cached resolution and (2) force refresh of the UDP channel since otherwise it would remain open and clueless about the change forever. I used 5 mins, hardcoded - this is a reasonable value for us, but if somebody else wants to improve with configurable settings, that would be an improvement. Keep in mind that refreshing a datagram channel is quite fast since there is no remote connection involved.
… JVM's cache instead and rely on the networkaddress.cache.ttl security property;
For the UDP sender, also added a refresh of the channel every 5 minutes - otherwise the same channel would keep sending to the same IP forever.
Signed-off-by: Gaspard Petit gaspard.petit@eidosmontreal.com