This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Embedding a REPL in a Java application
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.
In addition I get lots of failures in Compilation.getCurrent.
I haven't figured out what causes these.
--
--Per Bothner
per@bothner.com http://per.bothner.com/