public class Executors
Proporciona fábricas (factories) para generar diferentes tipos de Executor Services.
Se recogen algunos de las fábricas más usadas:
static ExecutorService newCachedThreadPool()
Se crean nuevos threads según se necesitan; pero si un thread termina, se recicla antes que crear uno nuevo.
static ExecutorService newFixedThreadPool(int
maximo)
Se utiliza hasta un máximo número de threads. Si hay más solicitudes que threads, esperan a que termine alguno.
static ExecutorService
newSingleThreadExecutor()
Utiliza un (1) thread. Si hay varias solicitudes, esperan a que termine.
static
ScheduledExecutorService newScheduledThreadPool(int maximo)
Se utiliza hasta un máximo número de threads. Si hay más solicitudes que threads, esperan a que termine alguno.
static
ScheduledExecutorService newSingleThreadScheduledExecutor()
Utiliza un (1) thread. Si hay varias solicitudes, esperan a que termine.
Ver ejemplo en “ejecutor”.
Temas relacionados