Ah, I think I know what the problem is. Your program terminates before the agent sends the data from the background thread to the server!
What you can do is to wait 20 seconds before terminating the program. You can also adjust the flush interval with this setting: https://www.elastic.co/guide/en/apm/agent/java/current/config-reporter.html#config-flush-interval.
I'll submit a patch so that it flushes the data on exit.