1 45 package org.exolab.jms.net; 46 47 import java.util.ArrayList ; 48 import java.util.Iterator ; 49 import java.util.List ; 50 51 52 58 public class CallbackServiceImpl implements CallbackService { 59 60 63 private List _callbacks = new ArrayList (); 64 65 70 public synchronized void addCallback(Callback callback) { 71 _callbacks.add(callback); 72 } 73 74 79 public synchronized void removeCallback(Callback callback) { 80 _callbacks.remove(callback); 81 } 82 83 88 public synchronized List getCallbacks() { 89 return _callbacks; 90 } 91 92 97 public void invoke(Object object) { 98 Iterator iterator = _callbacks.iterator(); 99 while (iterator.hasNext()) { 100 Callback callback = (Callback) iterator.next(); 101 callback.invoke(object); 102 } 103 } 104 105 } 106 | Popular Tags |