how to clear token_entry sql table?

During integration tests, I want to clear the database (using JPA storage engine) and I use this script to truncate all my H2 tables.
When I do that with token_entry, axon displays some messages about releasing tokens that weren’t owned by me, then it freezes for 10 seconds, and then starts executing the tests.

I am not very familiar with the concept of this token, but I know this is the way for tracking event handlers to keep track of which events they processed yet.

How to clear this table safely?

Also, just received this error (doesn’t always happen).

org.h2.jdbc.JdbcSQLTimeoutException: Timeout trying to lock table “TOKEN_ENTRY”; SQL statement:
TRUNCATE TABLE “TOKEN_ENTRY” RESTART IDENTITY [50200-199]

Hi Sam,

The Tracking Event Processors in an Axon application will claim the tokens in the token_entry table.
If you thus want to clear out the entire table, you will first have to shutdown all your Tracking Event Processors.
Doing so will ensure all the threads in your TEP’s are turned off, or paused as you will, giving you the opportunity to drop the token_entry table.

Hope this helps you out!

Cheers,
Steven