Search in sources :

Example 1 with TelemetryEmitter

use of org.terasology.engine.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.engine.config.Config) TelemetryConfig(org.terasology.engine.config.TelemetryConfig) TelemetryEmitter(org.terasology.engine.telemetry.TelemetryEmitter) URL(java.net.URL) TelemetryConfig(org.terasology.engine.config.TelemetryConfig)

Example 2 with TelemetryEmitter

use of org.terasology.engine.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.engine.telemetry.TelemetryEmitter)

Aggregations

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