@@ -17,21 +17,28 @@ public final class Analytics {
17
17
public static void SubmitAnonymousAddReferenceUsage (INativeTypesHandler typesHandler ) {
18
18
PluginSettingsService settings = PluginSettingsService .getInstance ();
19
19
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 ();
30
41
31
- javaResponseReader .close ();
32
- } catch (IOException e ) {
33
- // Ignore failure (eg no internet connection).
34
- }
35
42
}
36
43
}
37
44
}
0 commit comments