Yeah by default it is enable and it is using H2 as you mention.
I strongly recommend you switching to another more "serious" database if you are planning to start using the tools. H2 is used for development/demo purposes only.
as you said persistence is by default enabled.
i tried one example where an async tasks logs numbers from 1 to 200000.
when first time i run it, it took nearly 3 minutes to complete entire process and logging was done for all 1 to 200000 numbers in server.log file of jboss.
to check persistence i run it second time, this time when async task reached to logging 25000 numbers i stopeed jboss by stop.jboss command.
after 5 minutes i again started jboss by start.jboss.
ideally process should be resumed, right?
but i was seeing async job was running and process was also active but it was doing nothing( means no numbers were logged into log file)
and it still (after 2 hours) shows its running and process is active.
why is it so?
What do you mean by Async Task? Can you please be more specific, is it an executor task?? how does this task look like? Can you share some code?
H2 is started as an InMemory database, which means that as soon as you stop jboss it just go away. Again this is very useful for demos where you want to return to a zero state the next time that you start the application server. If you want you can change this to a file mode, where H2 will store a file to keep the status of the database between server restart. Look at the H2 configuration guide for doing so.
Regarding your async task, I'm afraid that it will not work as you expect. If you have a business process with an async task handled by the executor the task is completed or not, which means that if you shutdown the server when the task is running and start it again the task will start again, unless you implement a resuming mechanism. There is no way for the executor to know the internals of your domain specific task that counts from 1 to 25000.