accept and the end time after the thread creation.
This placement measures thread creation time, and indicates
to me that you do not understand thread flow of control. The end time should
be measured after the join.)sleep in the threads to inappropriately force
synchronization. (When I see sleep(1000) in random places in
a program, I know it doesn't work right.)StringBuffer. When the header is complete, the thread should
write to the log file. Actually a good approach is to have a separate LogFile
class and make its write method synchronized.)
indexOf("\n\r") to parse the header from
the resource. (In most cases, this approach resulted in taking the first
line of the response instead of the entire header.)String. (Several people
were confused by the parsing and the difference between a byte and a character in Java.
ServerSocket.)accept or in random methods throughout the
program.close must be in a try-catch.
close calls in the same try-catch. (
Method calls that release system resources (e.g., close) and might
throw exceptions MUST be
in their own try-catch block. For example:
try {
x.close();
y.close();
} catch ....
If x.close throws an exception, the socket resources for
y will not be released. Similar problems occur when you
put the close in the try-catch in which you
do I/O. In both cases, a long-running server will soon exceed
its resources.System.err not to
System.out.)
BufferedReader or readUTF or
used String for the files, that this was not done and that
the test cases had been carefully selected.)String. (Clearly you didn't run
tests with binary objects---or at least didn't mention it.)
GET line should be done in a helper.URL class
has everything you need to parse a URL.)String to concatenate characters in a loop ---
which results in copying to a completely new String on each concatenation.
(Use StringBuffer which is like String, but
supports mutable strings.)
GET would be good here.)
System.out instead of to
System.err.static final for buffer sizes if
they have to be fixed size. Then you only have to change the values in one
place and you know what the values represent.)