0

I have a question regarding to a strange behavior of my Java EE application. I had created a @Singleton EJB to schedule a process.

@Singleton
@Startup
public class BackgroundEmailLoader {

    @PostConstruct
     public void init (){
        DO SOMETHING
      }

    @Schedule(hour="*", minute="*/1", second="0", persistent=false)
    public void loadNewEmailsJob() {

        // TO SOMETHING


    }
}

Now every minute when the job starts, a new Thread (Default-EJB) is created and all other Threads of this task are still running. After some minutes there are a lot of Threads created. Is this a normal behavior? Could this cause a memory problem?

Technology Stack: Wildfly 8, Java EE 7

dexter meyers
  • 2,798
  • 2
  • 18
  • 22
Vik
  • 324
  • 3
  • 9
  • In a singleton, there should normally not be multiple threads active in one method. If the execution takes longer than 1 minute, the new attempts would block. Also, why do you use an early Alpha version of JBoss/WildFly? – dexter meyers Dec 02 '16 at 16:27
  • Question seems to be solved. When the maximum count of 10 threads is reached, the server stops to create new threads, i don't know why but so far the applcation doesen't make indication to get memory problems. – Vik Dec 07 '16 at 14:17

0 Answers0