01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.test.server.appserver.load;
05:
06: import org.apache.commons.httpclient.HttpClient;
07:
08: import com.tc.util.Assert;
09:
10: import java.net.URL;
11:
12: public class DataKeeperRequest implements Request {
13:
14: private static final int UNDEFINED = -1;
15: private long enterQueueTime;
16: private long exitQueueTime;
17: private long processCompletionTime;
18: private final HttpClient client;
19: private final int appserverID;
20: private final URL url;
21:
22: public DataKeeperRequest(HttpClient client, int appserverID, URL url) {
23: this .client = client;
24: this .appserverID = appserverID;
25: this .url = url;
26: this .enterQueueTime = UNDEFINED;
27: this .exitQueueTime = UNDEFINED;
28: this .processCompletionTime = UNDEFINED;
29: }
30:
31: public void setEnterQueueTime() {
32: Assert.assertEquals(UNDEFINED, this .enterQueueTime);
33: // this.enterQueueTime = System.nanoTime();
34: this .enterQueueTime = System.currentTimeMillis();
35: }
36:
37: public void setExitQueueTime() {
38: Assert.assertEquals(UNDEFINED, this .exitQueueTime);
39: // this.exitQueueTime = System.nanoTime();
40: this .exitQueueTime = System.currentTimeMillis();
41: }
42:
43: public void setProcessCompletionTime() {
44: Assert.assertEquals(UNDEFINED, this .processCompletionTime);
45: // this.processCompletionTime = System.nanoTime();
46: this .processCompletionTime = System.currentTimeMillis();
47: }
48:
49: public URL getUrl() {
50: return this .url;
51: }
52:
53: public long getEnterQueueTime() {
54: return this .enterQueueTime;
55: }
56:
57: public long getExitQueueTime() {
58: return this .exitQueueTime;
59: }
60:
61: public long getProcessCompletionTime() {
62: return this .processCompletionTime;
63: }
64:
65: public HttpClient getClient() {
66: return this .client;
67: }
68:
69: public int getAppserverID() {
70: return this .appserverID;
71: }
72:
73: public String toString() {
74: return "client=" + this .client + " AppserverID="
75: + this .appserverID;
76: }
77:
78: public String printData() {
79:
80: return this .enterQueueTime + "," + this .exitQueueTime + ","
81: + this .processCompletionTime + this .appserverID + ","
82: + this .client + ","
83: + this .client.getState().getCookies()[0].toString();
84: }
85: }
|