10 Ocak 2020 Cuma

Lang3 BasicThreadFactory Sınıfı

Giriş
Şu satırı dahil ederiz.
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
namingPattern metodu
Şöyle yaparız.
// Create a factory that produces daemon threads with a naming pattern and
 // a priority
 BasicThreadFactory factory = new BasicThreadFactory.Builder()
     .namingPattern("workerthread-%d")
     .daemon(true)
     .priority(Thread.MAX_PRIORITY)
     .build();
 // Create an executor service for single-threaded execution
 ExecutorService exec = Executors.newSingleThreadExecutor(factory);

Hiç yorum yok:

Yorum Gönder