Hey guys,
I've been reading the jetlang code and a few things are a mystery for me...
So PoolFiber... I see the default constructor takes 3 arguments:
Executor pool (ok makes sense)
BatchExecutor (well, there is only 1 implementation, and I'm not sure there is potential alternates)
ScheduledExecutorService (hmm)
So a few questions:
- does batch executor need to exist? There seems to be only 1 valid implementation, since if one had it do the batch in parallel you'd lose the single-thread at a time nature of a Fiber contract.
- ScheduledExecutorService - makes sense, but can one use the same executor for both the pool and the scheduler?
- I see that there is a call "schedulerThatIgnoresEventsAfterStop" - it seems like this concept is important... If I reuse a random executor as my scheduler (for eg: a netty4 executor is also a scheduled executor as well), would I run in to problems?
- If I must use a scheduler that ignores tasks once it's been shut down, and I use my own, will I have to worry about thread-lock or starvation issues? Specifically does the scheduler MUST be it's own thread as it appears to be if one uses the default PoolFiberFactory use model?
For example if I build a scheduled event executor and tell it to use 1 thread, and then assign that to a PoolFiberFactory, eg:
ScheduledExecutorService executor = // get this from, say, a netty4 event group loop
PoolFiberFactory fact = new PoolFiberFactory(executor, executor)
will I regret this later? Do I need to set the rejectionExecutionHandler like in SchedulerImpl.java?
Thanks!