tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <Chuck.Caldar...@unisys.com>
Subject RE: Peformance on socket reads
Date Fri, 15 May 2009 16:58:16 GMT
> From: David kerber [mailto:dckerber@verizon.net]
> Subject: Re: Peformance on socket reads

> What method would you suggest?  Create the byte array long enough to
> handle any possible input and then read without specifying the length?

No, keep allocating the byte array based on the content-length (plus perhaps a bit more for
insurance); but if you discover that there is more input than that, get a larger one and do
System.arraycopy() to save what you already processed.  That shouldn't happen very often,
so it's not a performance issue.  If it does happen often, your clients are broken and need
to be fixed.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.

Mime
View raw message