This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Embedding a REPL in a Java application


On 11/16/2009 12:28 AM, Per Bothner wrote:
On 11/15/2009 01:43 PM, Jamison Hope wrote:
I tried that, actually. It led to a stream of
ArrayIndexOutOfBoundsExceptions like this:

Exception in thread "AWT-EventQueue-0"
java.lang.ArrayIndexOutOfBoundsException: 24387
at gnu.lists.StableVector.allocPositionIndex(StableVector.java:111)
at gnu.lists.StableVector.createPos(StableVector.java:123)
at gnu.lists.SeqPosition.<init>(SeqPosition.java:55)
at gnu.kawa.swingviews.GapPosition.<init>(SwingContent.java:116)
at gnu.kawa.swingviews.SwingContent.createPosition(SwingContent.java:104)

These appear to be thread contention between the AWT thread and the finalizer thread. Adding "synchronized" before every method in StableVector "fixes" the problem.

A better solution would be avoid thread contention in the first place.
That would seem to require changing gnu.lists.SeqPosition to use
weak references rather than finalizers. I haven't looked into
what would be involved.

It may be best to replace the use of SwingContent by standard GapContent. Not a completely trivial fix, but doesn't look too difficult. Could you try that? The non-trivial part is changing checkingPendingInput to use GapContent.getChars and a Segment. -- --Per Bothner per@bothner.com http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]