Observer Example (3/4)
public class FileSystemMonitor {
private Vector myApps = new Vector();
public void addApplication(int app) {
myApps.addElement(new Integer(app));
public void removeApplication(int app) {
myApps.removeElement(new Integer(app));
public void refresh(int application) {
for (Enumeration e = myApps.elements(); e.hasMoreElements();) {
Integer tempApp = (Integer)e.nextElement();
if (tempApp.intValue() == application) {
System.out.println("Sending refresh message to application " + application);