An Executor with blocking submit()

Today we are going to talk about an executor that will be blocking on submit if n number of threads are already executing. Suppose if you have a threads running in parallel and they are resource intensive, you may want to limit the number of threads executing. This is what we will do in this … Read more

Start background thread using spring on startup

In this tutorial we will start a thread on the application startup using spring bean.So we will start the thread using @PostConstruct annotation on the method. So this makes sure that the annotated method is called before the Spring bean is put into service.  And we will be using executor service to start a thread. … Read more

Properly Shutting down an ExecutorService

I was recently working on an application that used hibernate for db access and lucene for storing and searching text. This combination was really great. It made searching really fast. And tomcat was used as the application container.Sometimes I used to get this exception on redeploy: And also tomcat used to complain that it could … Read more