Sorry, I think I misunderstood what you were saying before.

You want to use a single compiler in different threads, but you want the different compilations' error reports to be separable somehow.

I think the only way to do this is to put a ThreadLocal field into your ErrorListener, and use it to tell which compilation is being notified. This assumes that the compiler is going to notify the ErrorListener from the same thread it is invoked in.

-Archie

On Thu, Dec 27, 2012 at 1:50 PM, Michael Sokolov <sokolov@ifactory.com> wrote:
On 12/27/2012 11:45 AM, Archie Cobbs wrote:
Isn't that a problem for the ErrorListener, not the compiler?

In other words, if you re-use the same ErrorListener with multiple compilers in multiple threads, then you need to ensure your ErrorListener is thread safe.

-Archie
Well, that's true in some sense, but the question I have is: is there a way to use the *same* compiler in multiple threads, and also receive errors (with one or multiple ErrorListeners) in a thread-safe manner.

-Mike



--
Archie L. Cobbs