Currently, if an HTTP endpoint (e.g. a Spring Controller) uses an ExecutorService to run a task, none of that processing shows up in the AppMap. For example:
{http_server_request, thread: 1}
{call, method: ExecutorService.submit, thread:1}
{call, method: Runnable.run, thread: 1, task:true}
{call, method: DolphinChat.say("So"), thread: 1}
{return, parent: DolphinChat.say, thread: 1}
{call, method: DolphinChat.say("long"), thread: 1}
{return, parent: DolphinChat.say, thread: 1}
{return, parent:Runnable.run, thread: 1}
{return, parent: ExecutorService.submit, thread: 1} // when get is called on the Future returned by submit
{call, method: ExecutorService.submit, thread:1}
{call, method: Runnable.run, thread: 1, task:true}
{call, method: DolphinChat.say("and thanks for"), thread: 1}
{return, parent: DolphinChat.say, thread: 1}
{call, method: DolphinChat.say("all the fish"), thread: 1}
{return, parent: DolphinChat.say, thread: 1}
{return, parent:Runnable.run, thread: 1}
{return, parent: ExecutorService.submit, thread: 1} // when get is called on the Future returned by submit
{call, method: NextUp.say("Mostly Harmless"), thread: 1}
{return, parent: NextUp.say, thread: 1}
{http_server_response, thread: 1}
This says they all have the same thread id (that matches the thread that creates the ExecutorService). The ordering of the call and return events show that the calls to DolphinChat.say happened in a Runnable/Callable submitted to an ExecutorService. Note that the order of the complete Runnable.run call chains may not match the order in the code, of course, because they were run on separate threads.
Currently, if an HTTP endpoint (e.g. a Spring Controller) uses an
ExecutorServiceto run a task, none of that processing shows up in the AppMap. For example:the calls to
DolphinChatmethods won't show up in the AppMap.Instead, the (pseudo) events should look like this:
This says they all have the same thread id (that matches the thread that creates the
ExecutorService). The ordering of thecallandreturnevents show that the calls toDolphinChat.sayhappened in aRunnable/Callablesubmitted to anExecutorService. Note that the order of the completeRunnable.runcall chains may not match the order in the code, of course, because they were run on separate threads.Test cases:
dolphins, generates an AppMapExecutorService.submithas been calledCallableandRunnablepassed toExecutorService.submitare handled correctlydolphinsgenerates an AppMapdolphinsendpoint generates an AppMapFuture.cancelis called. [What should happen to the task's recording?]ExecutorService.submitreturns. [What should happen if there are outstandingFutures?]