All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rollbar.notifier.provider.server.ServerProvider Maven / Gradle / Ivy

Go to download

For connecting your applications built on the JVM to Rollbar for Error Reporting

The newest version!
package com.rollbar.notifier.provider.server;

import com.rollbar.api.payload.data.Server;
import com.rollbar.notifier.provider.Provider;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Server provider that populates the server's hostname.
 */
public class ServerProvider implements Provider {
  @Override
  public Server provide() {
    try {
      InetAddress host = InetAddress.getLocalHost();
      return new Server.Builder()
              .host(host.getHostName())
              .build();
    } catch (UnknownHostException e) {
      return new Server.Builder()
              .host("localhost")
              .build();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy