You can also use plain java RMI. quite easy and simple method.
SCJP SCWCD AIX SOA
The significant problems we face cannot be solved by the same level of thinking that created them -- Albert Einstein
Joined: Jul 30, 2010
It is on the same JVM.
Suppose there are two modules A and B and I want to send notification to B from A.
one way is to get the reference of B in A and invoke B's method but that is not the right
approach because i want to keep it generic and do not want to add any dependecies and more over
module B acts as pluggable component which may or may not be there.
Is there other approach for this or any design pattern which can be helpful?
Let A have a register method that accepts some sort of subscriber interface S (also known as a listener). A will keep track of a list of these subscribers.
When a change happens, A will then call the appropriate method in S of each subscriber.
B simply implements S, or has a helper class (tip: anonymous local class) that implements S and registers itself (or it's helper class) through A's register method.