The only thing I see that I need to synchronize with is the queue object, which I am. The queue object has synchronized methods for put and get also. But to remove that from the equation, I stripped all my code that did anything other than just reading the data, appending each line of data to the StringBuffer and sending the data to a file for inspection. I still get lost messages at several points in the transfer.
Because the messages are assembled at the client, in the client code, and a true EOF was not being placed at the end of the message (which readLine() should return a null with), we have settled on adding a tag of our own that we agreed upon, and if I don't get that tag I never break out of the readLine() loop, which is not a problem. The parts of the message that I am not getting are at the beginning of the message. I am usually only getting the last 1/4 or less of the message. BTW, the messages are XML messages with linefeeds ("\n") at the end of each line so that I just do a readLine() for each line of data. That way I don't have to worry about the size of each data packet getting out of hand.
I have also set the priority of the socket reading thread to one higher (10)than the other threads in my app (5). I have the other threads "wait(timespan)" after doing their work and I have the reading thread "Notify" after each object is placed in the queue. But, like I said, even if I don't do the other work and just display the messages to the System.out or a file I get the same message loss problem.
Thanks,
Lon