observer pattern summary from wikipedia
public class EventSource extends Observable implements Runnable {
}
public class ResponseHandler implements Observer {
}
main()
 final EventSource eventSource = new EventSource();
        // create an observer
        final ResponseHandler responseHandler = new ResponseHandler();
        // subscribe the observer to the event source
        eventSource.addObserver(responseHandler);
        // starts the event thread
        Thread thread = new Thread(eventSource);
        thread.start();
full link: http://en.wikipedia.org/wiki/Observer_pattern
No comments:
Post a Comment