Injectable, Configurable, Resilient and Monitorable ThreadPools in Java EE 7 -- Porcupine Is Available 📎
The Apache 2.0 licensed Project Porcupine is based on JSR 236: Concurrency Utilities for Java EE and allows you to setup injectable thread pools on-the-fly.
Each thread pool is created according to sensible conventions and produces an injectable statistics POJO. Not only the configuration, but also all major components are extensible without any additional configuration:
import com.airhacks.porcupine.execution.boundary.Dedicated;
import java.util.concurrent.ExecutorService;
import javax.inject.Inject;
public class MessagesService {
@Inject
@Dedicated
ExecutorService light;
@Inject
@Dedicated
ExecutorService heavy;
//...
}
The installation is easy:
<dependency>
<groupId>com.airhacks</groupId>
<artifactId>porcupine</artifactId>
<version>NEWEST_VERSION</version>
<scope>compile</scope>
</dependency>
and the dependency small (16 kB).
Enjoy https://github.com/AdamBien/porcupine and see you at workshops.adam-bien.com. Porcupine is heavily discussed during the workshops. Stay in touch with airhacksnews.com!.