Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 31 package org.objectweb.proactive.ic2d.spy; 32 33 import org.objectweb.proactive.core.UniqueID; 34 import org.objectweb.proactive.core.event.MessageEvent; 35 36 public class SpyMessageEvent extends SpyEvent implements java.io.Serializable { 37 38 39 protected String methodName; 40 41 42 protected UniqueID sourceID; 43 44 45 protected UniqueID destinationID; 46 47 48 protected long sequenceNumber; 49 50 51 protected int requestQueueLength; 52 53 54 public SpyMessageEvent(int eventType, MessageEvent message) { 55 super(eventType, (message.wasSent()) ? message.getSourceBodyID() : message.getDestinationBodyID()); 56 this.methodName = message.getMethodName(); 57 this.sourceID = message.getSourceBodyID(); 58 this.destinationID = message.getDestinationBodyID(); 59 this.sequenceNumber = message.getSequenceNumber(); 60 this.requestQueueLength = message.getRequestQueueLength(); 61 } 62 63 public String toString() { 64 return super.toString()+" methodName="+methodName+" requestQueue="+requestQueueLength; 65 } 66 67 70 public UniqueID getSourceBodyID() { 71 return sourceID; 72 } 73 74 75 public String getMethodName() { 76 return methodName; 77 } 78 79 80 public long getSequenceNumber() { 81 return sequenceNumber; 82 } 83 84 85 public UniqueID getDestinationBodyID() { 86 return destinationID; 87 } 88 89 public int getRequestQueueLength() { 90 return requestQueueLength; 91 } 92 93 95 public boolean wasSent() { 96 return type == REPLY_SENT_MESSAGE_TYPE || type == REQUEST_SENT_MESSAGE_TYPE; 97 } 98 99 100 public boolean isRequestMessage() { 101 return type == REQUEST_SENT_MESSAGE_TYPE || type == REQUEST_RECEIVED_MESSAGE_TYPE; 102 } 103 104 105 public boolean isReplyMessage() { 106 return type == REPLY_SENT_MESSAGE_TYPE || type == REPLY_RECEIVED_MESSAGE_TYPE || 107 type == VOID_REQUEST_SERVED_TYPE; 108 } 109 110 111 public boolean matches(SpyMessageEvent matchingEvent) { 112 if (matchingEvent.sequenceNumber != sequenceNumber) return false; 113 if (! matchingEvent.methodName.equals(methodName)) return false; 114 if ( (matchingEvent.sourceID.equals(sourceID) && matchingEvent.destinationID.equals(destinationID)) 115 || (matchingEvent.sourceID.equals(destinationID) && matchingEvent.destinationID.equals(sourceID)) ) 116 return true; 117 return false; 118 } 119 120 }
| Popular Tags
|