Search in sources :

Example 1 with TelemetryEmitter

use of org.terasology.telemetry.TelemetryEmitter in project Terasology by MovingBlocks.

the class TelemetrySubSystem method shutdown.

@Override
public void shutdown() {
    // shutdown emitter
    TelemetryEmitter telemetryEmitter = (TelemetryEmitter) emitter;
    telemetryEmitter.close();
}
Also used : TelemetryEmitter(org.terasology.telemetry.TelemetryEmitter)

Example 2 with TelemetryEmitter

use of org.terasology.telemetry.TelemetryEmitter in project Terasology by MovingBlocks.

the class TelemetrySubSystem method setTelemetryDestination.

private void setTelemetryDestination(Context rootContext) {
    Config config = rootContext.get(Config.class);
    TelemetryConfig telemetryConfig = config.getTelemetryConfig();
    String telemetryDestination = telemetryConfig.getTelemetryDestination();
    if (telemetryDestination != null) {
        try {
            URL url = new URL(telemetryDestination);
            TelemetryEmitter telemetryEmitter = (TelemetryEmitter) emitter;
            telemetryEmitter.changeUrl(url);
        } catch (MalformedURLException e) {
            logger.error("URL malformed", e);
        }
    } else {
        telemetryConfig.setTelemetryDestination(TelemetryEmitter.getDefaultCollectorURL(DEFAULT_COLLECTOR_PROTOCOL, DEFAULT_COLLECTOR_HOST, DEFAULT_COLLECTOR_PORT).toString());
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) Config(org.terasology.config.Config) TelemetryConfig(org.terasology.config.TelemetryConfig) TelemetryEmitter(org.terasology.telemetry.TelemetryEmitter) URL(java.net.URL) TelemetryConfig(org.terasology.config.TelemetryConfig)

Aggregations

TelemetryEmitter (org.terasology.telemetry.TelemetryEmitter)2 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Config (org.terasology.config.Config)1 TelemetryConfig (org.terasology.config.TelemetryConfig)1