Make test 906 retry to avoid gc races

Test 906 counts the total number of uncollected (note not necessarily
reachable) objects in the java heap. Due to the api design it cannot
do this in any sort of synchronized or atomic way. This is usually not
a problem though because the test does very little allocation so the
number of objects should not generally be changing. When run on CTS,
however, it is possible that objects might be created or collected
from other threads. This could cause the test to incorrectly fail. We
made this test retry the counting of objects up to 10 times in order
to hopefully get a count without racing other threads.

Test: ./test/run-test --host 906
Bug: 78344479
Change-Id: I80da119ed58193aae8d08e6f82ee4537fc979c85
1 file changed