1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 package com.reuters.msgtest.load;
34
35 import com.tibco.tibrv.TibrvMsg;
36
37
38 /***
39 * @author <a href="mailto:Kurman.Karabukaev@thoughtworks.com">Kurman</a>
40 *
41 */
42 public class LoadTestResult {
43 public static final Object EMPTY_KEY = new Object();
44 public static final LoadTestResult NONE = new LoadTestResult();
45 private long sentTime = -1;
46 private long receiveTime = -1;
47 private TibrvMsg responseMessage;
48 private Throwable error;
49 private Object key;
50
51 public LoadTestResult() {
52 this(-1);
53 }
54
55 public LoadTestResult(long sentTime) {
56 this(sentTime, -1, null);
57 }
58
59 public LoadTestResult(long sentTime, long receiveTime) {
60 this(sentTime, receiveTime, null);
61 }
62
63 public LoadTestResult(long sentTime, long receiveTime,
64 TibrvMsg responseMessage) {
65 this(sentTime, receiveTime, responseMessage, null);
66 }
67
68 public LoadTestResult(long sentTime, long receiveTime,
69 TibrvMsg responseMessage, Throwable error) {
70 setSentTime(sentTime);
71 setReceiveTime(receiveTime);
72 setResponseMessage(responseMessage);
73 setError(error);
74 }
75
76 public long getReceiveTime() {
77 return receiveTime;
78 }
79
80 public void setReceiveTime(long receiveTime) {
81 this.receiveTime = receiveTime;
82 }
83
84 public long getSentTime() {
85 return sentTime;
86 }
87
88 public void setSentTime(long sentTime) {
89 this.sentTime = sentTime;
90 }
91
92 public Throwable getError() {
93 return error;
94 }
95
96 public void setError(Throwable error) {
97 this.error = error;
98 }
99
100 public TibrvMsg getResponseMessage() {
101 return responseMessage;
102 }
103
104 public void setResponseMessage(TibrvMsg responseMessage) {
105 this.responseMessage = responseMessage;
106 }
107
108 public Object getKey() {
109 if (key == null) {
110 return EMPTY_KEY;
111 }
112
113 return key;
114 }
115
116 public void setKey(Object key) {
117 this.key = key;
118 }
119
120
121
122
123
124
125
126
127 public String toString() {
128 return "Send time: " + getSentTime() + ". Receive time: " +
129 getReceiveTime();
130 }
131
132 public boolean isError() {
133 return (getError() == null) ? false : true;
134 }
135 }