Jeremias Maerki wrote:

Ok, the FOEventHandler is created in the FOTreeBuilder. One FO
TreeBuilder is instantiated per processing run. The FOEventHandler is
set on FONode's static variable during startDocument(). The
FOEventHandler keeps track of used fonts, number of pages, tracking IDs
etc. which are all relevant to one document run.


Incidentally, I'd like to get the fonts out of FOEventHandler, I think they should be declared only within those subclasses of FOEventHandler that need them. But we can take up that issue later.

Now imagine a situation where multiple processing runs occur and just
after the TreeBuilder sets the FOEventHandler on FONode in
startDocument() and continues layout, another thread starts another
processing run and runs through FOTreeBuilder.startDocument() before the
whole layout process of the first processing run is finished.


But that would be another instance of the application, so that would be another instance's FOEventHandler that would be altered. Statics are common to a running instance, not all running instances of the same application in general. Please continue to elaborate.

Also, are you aware of why I switched to a static? To end the continuous recursion to the fo:root each time any of the child nodes need to call getFOEventHandler().startThisFormattingObject() and/or getFOEventHandler().endSomeFormattingObject().

Glen



Reply via email to