Skip to content

Commit 925877d

Browse files
committed
Make analytics call async
1 parent 85d7621 commit 925877d

File tree

2 files changed

+44
-44
lines changed

2 files changed

+44
-44
lines changed

src/ServiceStackIDEA/.idea/workspace.xml

Lines changed: 23 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ServiceStackIDEA/src/main/java/net/servicestack/idea/Analytics.java

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,28 @@ public final class Analytics {
1717
public static void SubmitAnonymousAddReferenceUsage(INativeTypesHandler typesHandler) {
1818
PluginSettingsService settings = PluginSettingsService.getInstance();
1919
if(!settings.optOutOfStats) {
20-
String url = addRefUrl + typesHandler.getTypesLanguage().name();
21-
URL serviceUrl = null;
22-
URLConnection javaResponseConnection = null;
23-
BufferedReader javaResponseReader = null;
24-
try {
25-
serviceUrl = new URL(url);
26-
javaResponseConnection = serviceUrl.openConnection();
27-
javaResponseReader = new BufferedReader(
28-
new InputStreamReader(
29-
javaResponseConnection.getInputStream()));
20+
final String url = addRefUrl + typesHandler.getTypesLanguage().name();
21+
final URL[] serviceUrl = {null};
22+
final URLConnection[] javaResponseConnection = {null};
23+
final BufferedReader[] javaResponseReader = {null};
24+
Thread thread = new Thread(new Runnable() {
25+
@Override
26+
public void run() {
27+
try {
28+
serviceUrl[0] = new URL(url);
29+
javaResponseConnection[0] = serviceUrl[0].openConnection();
30+
javaResponseReader[0] = new BufferedReader(
31+
new InputStreamReader(
32+
javaResponseConnection[0].getInputStream()));
33+
34+
javaResponseReader[0].close();
35+
} catch (IOException e) {
36+
// Ignore failure (eg no internet connection).
37+
}
38+
}
39+
});
40+
thread.start();
3041

31-
javaResponseReader.close();
32-
} catch (IOException e) {
33-
// Ignore failure (eg no internet connection).
34-
}
3542
}
3643
}
3744
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy