Actually thinking about it using a synchronisation to clean up the transaction cache creates a dependency on JTA. The transaction product is modulular with a Core module on top of which we build various transaction protocols such as JTA, JTS, XTS, STM etc. I want to keep the REST module dependent on core only otherwise it won't be usable by these other modules.
So a better idea is for the Coordinator to register itself as a participant and then clean the cache when it is told to commit/rollback.
I would either look at the test suite to see how to implement clients and participants or clone and run our quickstarts:
The REST-AT quickstarts are in a directory called rest-tx
|Retrieving data ...|