Regis wrote: > I just read the spec, it doesn't say the read method is synchronized or > thread-safe.
Agreed. The class description doesn't say anything about multiple threads. > I think BufferedInputStream just need to keep itself status consistent, > he never know how is the InputStream implemented, it's better to left > synchronous/asynchronous problems handled by the wrapped stream. Well at the moment we have the methods on BufferedInputStream marked as synchronized. That will ensure the consistency of the state in the buffered stream, and in the wrapped stream. Relaxing the sync on close() would pass through the multi-threading problems to the wrapped stream, but we still need to ensure the buffered stream is consistent, and that is non-trivial too (see my patch on the JIRA). Regards, Tim
