File tree Expand file tree Collapse file tree 1 file changed +25
-16
lines changed
smoke-tests/apps/Diagnostics/src/main/java/com/microsoft/applicationinsights/smoketestapp Expand file tree Collapse file tree 1 file changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -24,26 +24,35 @@ public String root() {
24
24
public String jfrFileHasDiagnostics () throws Exception {
25
25
Optional <Path > jfrFile ;
26
26
for (int i = 0 ; i < 60 ; i ++) {
27
+ try {
28
+ jfrFile =
29
+ Files .walk (new File ("/tmp/root/applicationinsights" ).toPath ())
30
+ .filter (Files ::isRegularFile )
31
+ .filter (it -> it .toFile ().getName ().contains (".jfr" ))
32
+ .findFirst ();
27
33
28
- jfrFile =
29
- Files .walk (new File ("/tmp/root/applicationinsights" ).toPath ())
30
- .filter (Files ::isRegularFile )
31
- .filter (it -> it .toFile ().getName ().contains (".jfr" ))
32
- .findFirst ();
33
-
34
- if (!jfrFile .isPresent ()) {
35
- Thread .sleep (1000 , 0 );
36
- continue ;
37
- }
34
+ if (!jfrFile .isPresent ()) {
35
+ Thread .sleep (1000 , 0 );
36
+ continue ;
37
+ }
38
38
39
- Path decompressedFile = decompressFile (jfrFile .get ());
39
+ Path decompressedFile = decompressFile (jfrFile .get ());
40
40
41
- boolean hasTelemetry =
42
- com .microsoft .applicationinsights .jfrfile .JfrFileReader .hasEventOfType (
43
- decompressedFile , "com.microsoft.applicationinsights.diagnostics.jfr.Telemetry" );
41
+ boolean hasTelemetry =
42
+ com .microsoft .applicationinsights .jfrfile .JfrFileReader .hasEventOfType (
43
+ decompressedFile , "com.microsoft.applicationinsights.diagnostics.jfr.Telemetry" );
44
44
45
- if (hasTelemetry ) {
46
- return String .valueOf (true );
45
+ if (hasTelemetry ) {
46
+ return String .valueOf (true );
47
+ }
48
+ } catch (Exception e ) {
49
+ // Ignore early exceptions, as to be expected, throw them if they are still happening
50
+ // towards the end
51
+ if (i > 55 ) {
52
+ throw e ;
53
+ } else {
54
+ Thread .sleep (1000 , 0 );
55
+ }
47
56
}
48
57
}
49
58
You can’t perform that action at this time.
0 commit comments