return t;
}
};
m_writeThread = MoreExecutors.listeningDecorator(
new ThreadPoolExecutor(
1,
1,
0,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
tf));
tf = new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread( r, "JitCask[" + m_caskPath + "] Sync Thread");
t.setDaemon(true);
return t;
}
};
m_syncThread = MoreExecutors.listeningDecorator(
new ScheduledThreadPoolExecutor(
1,
tf));
tf = new ThreadFactory() {
private final AtomicInteger m_counter = new AtomicInteger();
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(
null,
r,
"JitCask[" + m_caskPath + "] Read Thread " + m_counter.incrementAndGet(),
1024 * 256);
t.setDaemon(true);
return t;
}
};
m_readThreads = MoreExecutors.listeningDecorator(
new ThreadPoolExecutor(
READ_QUEUE_DEPTH,
READ_QUEUE_DEPTH,
0,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
tf,
new ThreadPoolExecutor.AbortPolicy()));
tf = new ThreadFactory() {
private final AtomicInteger m_counter = new AtomicInteger();
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(
null,
r,
"JitCask[" + m_caskPath + "] Compression Thread " + m_counter.incrementAndGet(),
1024 * 256);
t.setDaemon(true);
return t;
}
};
final int availableProcs = Runtime.getRuntime().availableProcessors() / 2;
m_compressionThreads =
MoreExecutors.listeningDecorator(
new ThreadPoolExecutor(
availableProcs,
availableProcs,
0,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(availableProcs),