Add observer pattern using java core