I'm creating a ThreadPoolExecutor and trying to set the rejection handler. However, Eclipse keeps giving me the error that ThreadPoolExecutor.DiscardPolicy cannot be resolved, even though it autocompletes it.
Am I missing something? I can't figure out a reason that it shouldn't work.
That wouldn't work because you can't pass a type name as a parameter. You need an instance of ThreadPoolExecutor.DiscardPolicy in that position, don't you?
Paul Clapham wrote:That wouldn't work because you can't pass a type name as a parameter. You need an instance of ThreadPoolExecutor.DiscardPolicy in that position, don't you?
Apparently so. When I was originally coding it, I thought DiscardPolicy was just a flag for ThreadPoolExecutor. I didn't realize it was it's own object.
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care: