It is currently possible to configure a direct (or direct static) task scheduler with an unhandled task capacity which enables back pressure. Back pressure does not make sense for direct schedulers because the task is executed immediately on the scheduling thread.
One solution is to add logic to TaskSchedulerBuilder.withType() to check if the type being set is direct and the unhandled capacity is already set, and logic to TaskSchedulerBuilder.withUnhandledTaskCapacity() that checks if the type is already set to direct. In each case, if the combination of type and unhandled task capacity are incompatible, throw an exception.
This check could also be done in the TaskSchedulerBuilder.build() method.
It is currently possible to configure a direct (or direct static) task scheduler with an unhandled task capacity which enables back pressure. Back pressure does not make sense for direct schedulers because the task is executed immediately on the scheduling thread.
One solution is to add logic to
TaskSchedulerBuilder.withType()
to check if the type being set is direct and the unhandled capacity is already set, and logic toTaskSchedulerBuilder.withUnhandledTaskCapacity()
that checks if the type is already set to direct. In each case, if the combination of type and unhandled task capacity are incompatible, throw an exception.This check could also be done in the
TaskSchedulerBuilder.build()
method.