Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document - Riemann-java-client internally caches DNS records #62

Open
shanielh opened this issue Sep 20, 2015 · 0 comments
Open

Document - Riemann-java-client internally caches DNS records #62

shanielh opened this issue Sep 20, 2015 · 0 comments

Comments

@shanielh
Copy link
Contributor

I'm doing it for documentation, Since I got a problem with it and I managed to solve it.

The TcpTransport and UdpTransport internally cache the IP address of a DNS record, It can be explicitly disabled.

My problem was that sometimes the riemann server changed the internal IP, And I got to it using an internal DNS, After that the riemann changed the IP, The client never sent events to the server.

The problem was that internal caching, I managed to cancel that caching using a simple code (The example given is in scala, But I'm sure you can write it in Java)

private def disableDnsCache(transport: Transport): Unit = {
  getDnsOption(transport).foreach(_.set(false))
}

private def getDnsOption(transport: Transport): Traversable[AtomicBoolean] = {
  transport match {
    case udp: UdpTransport => Some(udp.cacheDns)
    case tcp: TcpTransport => Some(tcp.cacheDns)
    case async: AsynchronizeTransport => getDnsOption(async.transport)
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant