[cp-patches] FYI: AbstractDocument

Roman Kennke roman at kennke.org
Mon Nov 20 10:52:53 UTC 2006


This makes the locking impl in AbstractDocument more straightforward
(and therefore, more robust, I hope). And it makes the
DefaultDocumentEvent behave a little better memory and performance wise.
It switches to HashTable usage only when exceeding a certain threshold.

2006-11-20  Roman Kennke  <kennke at aicas.com>

	* javax/swing/text/AbstractDocument.java
	(DefaultDocumentEvent.changes): Changed to be a HashMap.
	(DefaultDocumentEvent.modified): Made private.
	(DefaultDocumentEvent.THRESHOLD): New constant field.
	(DefaultDocumentEvent.DefaultDocumentEvent): Don't initialize
	changes table.
	(DefaultDocumentEvent.addEdit): Switch to hashmap only when
	exceeding threshold.
	(DefaultDocumentEvent.getChange): Use iterative approach
	when we have no hashmap yet.
	(documentCV): Removed.
	(numWriters): Renamed from numWritersWaiting.
	(createPosition): Reformat.
	(getCurrentWriter): Synchronized.
	(readLock): Implement more straightforward.
	(readUnlock): Implement more straightforward.
	(writeLock): Implement more straightforward.
	(writeUnlock): Implement more straightforward.
	(remove): Write-lock here.
	(removeImpl): Don't write-lock here.

/Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 18544 bytes
Desc: not available
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20061120/2b42b4ae/patch-0001.bin


More information about the Classpath-patches mailing list