My understanding is that it seems very similar to Abstract Factory.
Note:
The executor interface:
public interface Executor {
public void execute();
}
And then there is an Executors
class containing static factories for various Executor
implementations.
It's not Abstract Factory. It is Mediator pattern coupled with Command pattern.
Executor interface is command pattern. Implementing execute()
is obeying a Command.
According to GoF, Mediator pattern intent is:
Allows loose coupling by encapsulating the way disparate sets of objects interact and communicate with each other. Allows for the actions of each object set to vary independently of one another.
Mediator Pattern in JDK
java.util.Timer class scheduleXXX()
methods
java.util.concurrent.Executor class execute()
method.
java.lang.reflect.Method class invoke()
method
Have a look source article for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With