Review Request: CR 7100996 - (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads (original) (raw)
Jim Gish jim.gish at oracle.com
Thu Jun 21 15:59:47 UTC 2012
- Previous message: RFR [JDK8]: 7169894: JAXP Plugability Layer: using service loader
- Next message: Review Request: CR 7100996 - (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Please review the proposed spec change to StringBuffer below, which informs the user about additional thread safety issues as described in the bug. (Thanks to Brian for the language).
Thanks, Jim
diff -r 46ff1b63b0c3 src/share/classes/java/lang/StringBuffer.java --- a/src/share/classes/java/lang/StringBuffer.java Mon Jun 11 07:10:48 2012 -0400 +++ b/src/share/classes/java/lang/StringBuffer.java Thu Jun 21 11:45:51 2012 -0400 @@ -63,6 +63,14 @@
- appending or inserting from a source sequence) this class synchronizes
- only on the string buffer performing the operation, not on the source.
- While StringBuffer is designed to be safe to use concurrently from
- multiple threads, the source data passed to append/insert, if shared
- across threads, must ensure that StringBuffer.add/insert has a
- consistent and unchanging view of the source data for the duration of
- the operation. This could be done by the caller holding a lock during
- the add/insert call, or because the source data is immutable, or because
- the source data is not shared across threads.
- Every string buffer has a capacity. As long as the length of the
- character sequence contained in the string buffer does not exceed
- the capacity, it is not necessary to allocate a new internal
-- Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304 Oracle Java Platform Group | Core Libraries Team 35 Network Drive Burlington, MA 01803 jim.gish at oracle.com
- Previous message: RFR [JDK8]: 7169894: JAXP Plugability Layer: using service loader
- Next message: Review Request: CR 7100996 - (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]