1 31 package org.objectweb.proactive.core.body.future; 32 33 import org.objectweb.proactive.core.event.AbstractEventProducer; 34 import org.objectweb.proactive.core.event.FutureEventListener; 35 import org.objectweb.proactive.core.event.ProActiveEvent; 36 import org.objectweb.proactive.core.event.ProActiveListener; 37 import org.objectweb.proactive.core.event.FutureEvent; 38 import org.objectweb.proactive.core.body.future.FutureEventProducer; 39 import org.objectweb.proactive.core.UniqueID; 40 41 public class FutureEventProducerImpl extends AbstractEventProducer implements FutureEventProducer, java.io.Serializable { 42 43 public FutureEventProducerImpl() {} 44 45 49 public void notifyListeners(UniqueID bodyID, UniqueID creatorID, int type) { 50 if (hasListeners()) 51 notifyAllListeners(new FutureEvent(bodyID, creatorID, type)); 52 } 53 54 public void notifyOneListener(ProActiveListener listener, ProActiveEvent futureEvent) { 55 switch (futureEvent.getType()) { 56 case FutureEvent.WAIT_BY_NECESSITY : 57 ((FutureEventListener)listener).waitingForFuture((FutureEvent)futureEvent); 58 break; 59 case FutureEvent.RECEIVED_FUTURE_RESULT : 60 ((FutureEventListener)listener).receivedFutureResult((FutureEvent)futureEvent); 61 break; 62 } 63 } 64 65 66 70 public void addFutureEventListener(FutureEventListener listener) { 71 addListener(listener); 72 } 73 74 public void removeFutureEventListener(FutureEventListener listener) { 75 removeListener(listener); 76 } 77 78 79 80 } | Popular Tags |