In
run()
, first the time is recorded indicating the start time of the data stream(line 19). The
input stream,
in
, is read at a byte per iteration, (line 20). This data is when written to
out
(line 22). The amount of read data is tracked also (line 23). When there is no more data to
read, the end time is recorded (line 25), as is the amount of data that has been transferred
(line 26).
Examining this closer,
out
in
RequestDataMover
is a reference to
pout
in
HTTPQoS
and
pout
is fed to
pin
in
HTTPQoS
. Since the request's output stream in
HTTPQoS
is passed
pin
,
this allows the data can be monitored effectively while transferring it to the server but not
interrupting the data stream.
RequestDataMover.java ..continued
13.
14. public void run() {
15. try {
16. byte buf[] = new byte[1];
17. int got = 1;
18. myQoSParameters.setRequestBodyStartTime(System.currentTimeMillis());
19. int contentLenght = 0;
20. while ((got = in.read(buf)) >= 0){
21. out.write(buf, 0, got);
22. contentLenght = contentLenght + 1;
23. }
24. myQoSParameters.setRequestBodyEndTime(System.currentTimeMillis());
25. myQoSParameters.setRequestContentLength(contentLenght);
26. } catch (IOException ex) {
27. ex.printStackTrace();
28. } finally {
29. try { in.close(); } catch (Exception ex) {};
30. try { out.close(); } catch (Exception ex) {} ;
31. }
32. }
ReplyDataMover
similarly does the same the process for a request in HTTPQoS except data
is passed in the opposite direction. The effectiveness of the features described previously to
a
a
e