I am using the LMAX disruptor and it works really well.
I would like to execute some core affinity code (that needs to run ON THE DISRUPTOR HANDLER's THREAD), at the begginning of the disruptor's thread lifecycle.
I tried overriding the start method in the disruptor, but this code still runs on the executing thread and not the disruptor thread, something like this:
ThreadFactory factory = new ThreadFactoryBuilder().setNameFormat("DisruptorThread").build();
Disruptor<OrderBasedEventHolder> disruptor = new Disruptor<>(new Disruptor<Holder> disruptor = new Disruptor<Holder>(new HolderFactory(), (int) Math.pow(2, bufferExp), factory, pType, waitStrategy) {
@Override public RingBuffer<OrderBasedEventHolder> start() {
// Initialization code
return super.start();
}
};
disruptor.start();
How can override the run() method of the thread created by the ThreadFactory?
Thanks!!!