As @Balus has explained in Spawning threads in a JSF managed bean for scheduled tasks using a timer
EJB available? Use @Schedule If you target Java EE 6 or newer (e.g. JBoss AS, GlassFish, TomEE, etc and thus not a barebones JSP/Servlet container such as Tomcat), then use a @Singleton EJB with a @Schedule method instead. This way the container will worry itself about pooling and destroying threads via ScheduledExecutorService.
So i am curious to know by using @Schedule, the background process will run asynchronously by container managed threads (magically) or it is like a java.util.timer which creates single thread and all process run within this threads??
if @Schedule creates only single thread just to manage the scheduler then would it be safe to use further ScheduledExecutorService within @Schedule? and this ScheduledExecutorService contains further runnable tasks based on multiple threads.
I have a long running process including file manipulation, data processing and email generating, but really should i rely only on this single @Schedule annotation without using any executorservices/creating further threadpool?? BTW i am using Glassfish.