1 31 package org.objectweb.proactive.core.event; 32 33 import org.objectweb.proactive.core.UniqueID; 34 import org.objectweb.proactive.core.body.message.Message; 35 36 48 public class MessageEvent extends ProActiveEvent implements Message, java.io.Serializable { 49 50 51 public static final int REQUEST_SENT = 10; 52 53 public static final int REQUEST_RECEIVED = 20; 54 55 public static final int REPLY_SENT = 30; 56 57 public static final int REPLY_RECEIVED = 40; 58 59 public static final int VOID_REQUEST_SERVED = 50; 60 61 public static final int SERVING_STARTED = 60; 62 63 protected UniqueID destinationID; 64 65 67 protected int requestQueueLength; 68 69 79 public MessageEvent(Message message, int messageActionType, UniqueID destinationID, 80 int requestQueueLength) { 81 super(message, messageActionType); 82 this.destinationID = destinationID; 83 this.requestQueueLength = requestQueueLength; 84 } 85 86 87 91 97 public UniqueID getDestinationBodyID() { 98 return destinationID; 99 } 100 101 105 public int getRequestQueueLength() { 106 return requestQueueLength; 107 } 108 109 113 public String toString() { 114 return "methodName="+getMethodName()+" sourceID="+getSourceBodyID()+" destinationID="+getDestinationBodyID()+" sequenceNumber="+getSequenceNumber(); 115 } 116 117 public boolean wasSent() { 118 return type == REQUEST_SENT || type == REPLY_SENT; 119 } 120 121 125 public UniqueID getSourceBodyID() { 126 return getMessage().getSourceBodyID(); 127 } 128 129 public String getMethodName() { 130 return getMessage().getMethodName(); 131 } 132 133 public long getSequenceNumber() { 134 return getMessage().getSequenceNumber(); 135 } 136 137 public boolean isOneWay() { 138 return getMessage().isOneWay(); 139 } 140 141 142 146 private final Message getMessage() { 147 return (Message) getSource(); 148 } 149 150 } | Popular Tags |