Skip to content

Commit

Permalink
Merge pull request #1341 from realm/ez-allow-disable-analytics
Browse files Browse the repository at this point in the history
Ignore errors in analytics BG thread and allow disabling it
  • Loading branch information
emanuelez committed Aug 3, 2015
2 parents b319f7e + b1e5b6b commit 337e763
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.realm.processor;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -97,8 +96,7 @@ private void send() {
connection.setRequestMethod("GET");
connection.connect();
connection.getResponseCode();
} catch (IOException ignored) {
} catch (NoSuchAlgorithmException ignored) {
} catch (Exception ignored) {
}
}

Expand All @@ -112,7 +110,9 @@ public void run() {
backgroundThread.start();
try {
backgroundThread.join(CONNECT_TIMEOUT + READ_TIMEOUT);
} catch (InterruptedException e) {
} catch (InterruptedException ignored) {
// We ignore this exception on purpose not to break the build system if this class fails
} catch (IllegalArgumentException ignored) {
// We ignore this exception on purpose not to break the build system if this class fails
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,11 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
}
}

RealmAnalytics analytics = RealmAnalytics.getInstance(packages);
analytics.execute();
String environmentVariable = System.getenv("REALM_DISABLE_ANALYTICS");
if (environmentVariable == null || !environmentVariable.equals("true")) {
RealmAnalytics analytics = RealmAnalytics.getInstance(packages);
analytics.execute();
}

hasProcessedModules = true;
return processModules(roundEnv);
Expand Down

0 comments on commit 337e763

Please sign in to comment.