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 EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
07:
08: import com.tc.test.server.util.HttpUtil;
09:
10: public class RequestQueueHandler extends Thread {
11:
12: private final LinkedQueue queue;
13:
14: public RequestQueueHandler(LinkedQueue queue) {
15: this .queue = queue;
16: }
17:
18: public void run() {
19: while (true) {
20: try {
21: Object obj = this .queue.take();
22: if (obj instanceof ExitRequest) {
23: return;
24: } else if (obj instanceof Request) {
25: Request request = (Request) obj;
26: request.setExitQueueTime();
27: HttpUtil.getInt(request.getUrl(), request
28: .getClient());
29: request.setProcessCompletionTime();
30: } else {
31: throw new AssertionError(
32: "EventQueue was populated with a non-Request object.");
33: }
34: } catch (Exception e) {
35: throw new RuntimeException(e);
36: }
37: }
38: }
39: }
|