Ivanov, Alexey A wrote:
-----Original Message-----
From: Igor Stolyarov [mailto:[EMAIL PROTECTED]
Sent: Friday, July 28, 2006 1:04 PM
To: harmony-dev@incubator.apache.org
Subject: Re: AWT 2D PERFORMANCE ISSUE

I think using WeakReference and ReferenceQueue can't help because
according
to RI I have to give customer array

You give the customer that array, and store a Weak- or PhantomReference
in your object. When you need to update some data, you can check if the
array you gave is still "alive" or not.

I dealt with this kind of problem in javax.swing.text.GapContent. Its
createPosition() method should return an object to client. This object
returned must be updated when data (text) stored in GapContent is
modified. To reduce the number of Position objects to be updated, I used
PhantomReferences to be notified that the object I returned to client
was cleared by garbage collector.

Has anyone else dealt with reference APIs and similar problems?
Just noticed this thread, for your information, there is a o.a.h.luni.platform.IMemorySpy in modules/luni/ module, which is used to free the direct/mapped buffers using ReferenceQueue, and maybe there is some chance to refactor so that it can be more widely used (currently it is limited by the coupling with PlatformAddress, maybe some interface can be extracted, say Freeable or so), because I have seen several similar requirements in different modules(nio, java.net, and awt as well as swing here), so it will be good if we can reuse the codes. And at least, it can be some sample codes of ReferenceQueue:).

Regards,
Alexey.

On 7/28/06, Ivanov, Alexey A <[EMAIL PROTECTED]> wrote:
-----Original Message-----
From: Igor Stolyarov [mailto:[EMAIL PROTECTED]
Sent: Friday, July 28, 2006 9:25 AM
To: harmony-dev@incubator.apache.org
Subject: Re: AWT 2D PERFORMANCE ISSUE

I'm sorry. May be I don't clear explained my question. Main target
of
my
question was discussion of synchronization of two arrays one of
these
is
java array, second is native array. Main issue of this
synchronization
is
the fact that customer can recieve reference to the java array and
we
don't
know when customer will release the array.
What about using Weak- or PhantomReferences and ReferenceQueue? They
may
solve your problem.

Regards,
--
Alexey A. Ivanov
Intel Middleware Product Division

<SNIP>

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
--
Igor V. Stolyarov
Intel Middleware Products Division

--
Alexey A. Ivanov
Intel Middleware Product Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Paulex Yang
China Software Development Lab
IBM



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to