Fix 004-ThreadStress.

Synchronize the start of performing the tasks after all
threads have been created and runners reported their start.
This prevents a daemon thread from allocating all memory
before the main thread tries to allocate the next daemon
thread, which is the likely culprit of failing to print any
output whatsoever (the main thread exits due to an uncaught
OOME and printing the message also fails due to OOME).

Instead of repeating attempts to print "Finishing worker"
until it succeeds, print the message through JNI which does
not require any Java heap memory. Similarly, print caught
Throwables through JNI. Also make sure to preallocate
Strings that are used once we start running tasks to avoid
const-string throwing OOME. This also prevents a partial
success followed by a retry; we have seen a failure to
print the EOL, yielding "Finishing workerFinishing worker".

Change the "Thread exited..." message to be printed only in
DEBUG mode and compare the full output, ignoring different
numbers as the "Starting worker for <id>" may be reordered.

Test: "make -j 32 test-art-host-run-test-004-ThreadStress"
    (4 configs: with or without gcstress, 32-bit and 64-bit)
    100 times while also keeping the machine under load with
    "make -j 32" to repeatedly build another full AOSP tree.
Bug: 27371304
Change-Id: I28286d70a08be64c36d0e49dd5558686813ff264
5 files changed